Updated list-news.ps1

This commit is contained in:
Markus Fleschutz 2024-11-22 14:28:19 +01:00
parent 390b5ffe71
commit bdc4cb1002
2 changed files with 8 additions and 9 deletions

View File

@ -84,7 +84,7 @@ try {
} }
if ($reason -ne "") { if ($reason -ne "") {
$status = "⚠️" $status = "⚠️"
$pending = "with pending reboot ($($reason.substring(2)) in registry)" $pending = "with pending reboot (registry has $($reason.substring(2)))"
} }
} }
Write-Host "$status $(hostname) is up for $(TimeSpanAsString $uptime) since $($lastBootTime.ToShortDateString()) $pending" Write-Host "$status $(hostname) is up for $(TimeSpanAsString $uptime) since $($lastBootTime.ToShortDateString()) $pending"

View File

@ -22,22 +22,21 @@
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([string]$RSS_URL = "https://news.yahoo.com/rss/world", [int]$maxLines = 24, [int]$speed = 10) param([string]$RSS_URL = "https://news.yahoo.com/rss/world", [int]$maxLines = 24, [int]$speed = 5)
try { 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 "`nUTC HEADLINES (by: " -noNewline
" UTC $title - $URL" Write-Host $URL -foregroundColor blue -noNewline
" --- -----------------------------------------------------------------------" 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 $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