mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Add check-headlines.ps1
This commit is contained in:
parent
38c8ef7b8c
commit
38f4bb9d95
@ -25,7 +25,7 @@ More supported voice commands are:
|
||||
|
||||
`Computer, check` [name]
|
||||
------------------------
|
||||
Lets the computer check something, replace [name] by: `CPU`, `date`, `DNS`, `drives`, `Earth` (fun), `Moon`, `operating system`, `ping`, `Sun`, `swap space`, `time`, `time zone`, `up-time`, `VPN`, or `weather`.
|
||||
Lets the computer check something, replace [name] by: `CPU`, `date`, `DNS`, `drives`, `Earth` (fun), `headlines`, `Moon`, `operating system`, `ping`, `Sun`, `swap space`, `time`, `time zone`, `up-time`, `VPN`, or `weather`.
|
||||
|
||||
|
||||
`Computer, open` [name] `browser`
|
||||
|
33
Scripts/check-headlines.ps1
Normal file
33
Scripts/check-headlines.ps1
Normal file
@ -0,0 +1,33 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the latests headlines
|
||||
.DESCRIPTION
|
||||
This script tells the latest headlines by text-to-speech (TTS).
|
||||
.PARAMETER RSS_URL
|
||||
Specifies the URL to the RSS feed
|
||||
.PARAMETER MaxCount
|
||||
Specifies the number of news to list
|
||||
.EXAMPLE
|
||||
PS> ./list-news
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
param([string]$RSS_URL = "https://yahoo.com/news/rss/world", [int]$MaxCount = 8)
|
||||
|
||||
try {
|
||||
[xml]$Content = (invoke-webRequest -uri $RSS_URL -useBasicParsing).Content
|
||||
[int]$Count = 0
|
||||
foreach ($item in $Content.rss.channel.item) {
|
||||
"→ $($item.title)"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$($item.title)"
|
||||
$Count++
|
||||
if ($Count -eq $MaxCount) { break }
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user