From 8bf0a8e8f0a6e67666997cfef8d6f4e34c931fd0 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 13 Jun 2024 12:01:41 +0200 Subject: [PATCH] Updated watch-news.ps1 --- scripts/watch-news.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/watch-news.ps1 b/scripts/watch-news.ps1 index 6ff129fa..25d0938a 100755 --- a/scripts/watch-news.ps1 +++ b/scripts/watch-news.ps1 @@ -5,8 +5,10 @@ This PowerShell script lists the latest headlines by using a RSS (Really Simple Syndication) feed. .PARAMETER RSS_URL Specifies the URL to the RSS feed (Yahoo World News by default) +.PARAMETER lines + Specifies the initial number of headlines .PARAMETER timeInterval - Specifies the time interval in millisec between the Web requests + Specifies the time interval in seconds between the Web requests .EXAMPLE PS> ./watch-news.ps1 ❇️ Niger coup: Ecowas deadline sparks anxiety in northern Nigeria ❇️ @@ -16,7 +18,7 @@ Author: Markus Fleschutz | License: CC0 #> -param([string]$RSS_URL = "https://news.yahoo.com/rss/world", [int]$timeInterval = 30000) # in ms +param([string]$RSS_URL = "https://news.yahoo.com/rss/world", [int]$lines = 10, [int]$timeInterval = 30) # in seconds function PrintLatestHeadlines([string]$previous, [int]$maxLines) { [xml]$content = (Invoke-WebRequest -URI $RSS_URL -useBasicParsing).Content @@ -37,8 +39,8 @@ function PrintLatestHeadlines([string]$previous, [int]$maxLines) { try { $latest = "" while ($true) { - $latest = PrintLatestHeadlines $latest 10 - Start-Sleep -milliseconds $timeInterval + $latest = PrintLatestHeadlines $latest $lines + Start-Sleep -seconds $timeInterval } exit 0 # success } catch {