mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 21:07:40 +02:00
Improve list-news.ps1
This commit is contained in:
@ -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 {
|
||||||
|
Reference in New Issue
Block a user