mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-20 04:38:43 +01:00
Updated list-news.ps1
This commit is contained in:
parent
86c15a6982
commit
982debb892
@ -12,9 +12,9 @@
|
||||
.EXAMPLE
|
||||
PS> ./list-news.ps1
|
||||
|
||||
UTC HEADLINES (source: https://www.yahoo.com/news/world)
|
||||
--- ---------
|
||||
09:15 • Deadly Mediterranean wildfires kill more than 40
|
||||
UTC HEADLINES (source: https://www.yahoo.com/news/world)
|
||||
--- ---------
|
||||
09:15 Deadly Mediterranean wildfires kill more than 40
|
||||
...
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
@ -28,19 +28,19 @@ try {
|
||||
[xml]$content = (Invoke-WebRequest -URI $RSS_URL -useBasicParsing).Content
|
||||
$title = $content.rss.channel.title
|
||||
$URL = $content.rss.channel.link
|
||||
Write-Host "`n UTC HEADLINES (source: " -noNewline
|
||||
Write-Host "`n UTC HEADLINES (source: " -noNewline
|
||||
Write-Host $URL -foregroundColor blue -noNewline
|
||||
Write-Host ")"
|
||||
Write-Host " --- ---------"
|
||||
Write-Host " --- ---------"
|
||||
[int]$count = 1
|
||||
foreach ($item in $content.rss.channel.item) {
|
||||
$title = $item.title -replace "â","'"
|
||||
$time = $item.pubDate.Substring(11, 5)
|
||||
& "$PSScriptRoot/write-typewriter.ps1" "$time • $title" $speed
|
||||
& "$PSScriptRoot/write-typewriter.ps1" "$time $title" $speed
|
||||
if ($count++ -eq $maxLines) { break }
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user