Improve list-news.ps1

This commit is contained in:
Markus Fleschutz
2021-04-18 12:02:37 +02:00
parent e273ec2d9e
commit 7ffe1aae95

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh #!/usr/bin/pwsh
<# <#
.SYNTAX list-news.ps1 [<RSS-URL>] .SYNTAX list-news.ps1 [<RSS-URL>]
.DESCRIPTION lists the latest news .DESCRIPTION lists the latest news
@ -10,13 +10,13 @@ param($RSS_URL = "https://yahoo.com/news/rss/world")
try { try {
[xml]$Content = (invoke-webRequest -URI $RSS_URL).Content [xml]$Content = (invoke-webRequest -URI $RSS_URL).Content
"`n🌍 $($Content.rss.channel.title) 🌏"
write-output "" [int]$Count = 0
write-output "+++ $($Content.rss.channel.title) +++"
write-output ""
foreach ($item in $Content.rss.channel.item) { foreach ($item in $Content.rss.channel.item) {
write-output "* $($item.title)" " $($item.title)"
$Count++
if ($Count -eq 26) { break }
} }
exit 0 exit 0
} catch { } catch {