Updated list-news.ps1

This commit is contained in:
Markus Fleschutz 2024-12-30 22:48:31 +01:00
parent 86c15a6982
commit 982debb892

View File

@ -12,9 +12,9 @@
.EXAMPLE .EXAMPLE
PS> ./list-news.ps1 PS> ./list-news.ps1
UTC HEADLINES (source: https://www.yahoo.com/news/world) UTC HEADLINES (source: https://www.yahoo.com/news/world)
--- --------- --- ---------
09:15 Deadly Mediterranean wildfires kill more than 40 09:15 Deadly Mediterranean wildfires kill more than 40
... ...
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -28,15 +28,15 @@ try {
[xml]$content = (Invoke-WebRequest -URI $RSS_URL -useBasicParsing).Content [xml]$content = (Invoke-WebRequest -URI $RSS_URL -useBasicParsing).Content
$title = $content.rss.channel.title $title = $content.rss.channel.title
$URL = $content.rss.channel.link $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 $URL -foregroundColor blue -noNewline
Write-Host ")" Write-Host ")"
Write-Host " --- ---------" Write-Host " --- ---------"
[int]$count = 1 [int]$count = 1
foreach ($item in $content.rss.channel.item) { foreach ($item in $content.rss.channel.item) {
$title = $item.title -replace "â","'" $title = $item.title -replace "â","'"
$time = $item.pubDate.Substring(11, 5) $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 } if ($count++ -eq $maxLines) { break }
} }
exit 0 # success exit 0 # success