Hi, I have a small script that goes and check for new rss feed every 1 minute, and the function goes to sleep for another minute. How can I make the function not to keep downloading the same title, unless there is a new topic.
$webclient = new-object System.Net.WebClient
$url=“https://something”
Get the web page into a single string
$data = [xml](invoke-webrequest $url).Content
$Time = Get-Date -format g
$LastBuiltDate = ($data.rss.channel.LastBuildDate).split(‘’)[4]
$TimeDiff = New-TimeSpan -Start $LastBuiltDate -End $Time
if($TimeDiff.minutes -lt 1){
$items = ($data.rss.channel.item | select title,Description,link, @{LABEL=“Published”;EXPRESSION={[datetime]$_.pubdate}}|sort-object Published)
foreach ($msg in $items){
$titlen = $msg.title -replace ‘<br ?/?>’,[System.Environment]::NewLine -replace ‘<[^>]+>’
$Published = $msg.Published
$commentsPlain = $msg.Description.InnerText -replace ‘<br ?/?>’,[System.Environment]::NewLine -replace ‘<[^>]+>’
$weblinks = $msg.link.innertext
}
}