The most common technology presented which .NET people looking for. Its gonna be your turn now.
Wednesday, October 22, 2025
Powershell script to bring news from news Feeds and create a nice looking HTML page.
# ===== DailyNews.ps1 =====
# RSS feed URLs
$techFeeds = @(
"https://techcrunch.com/feed/",
"https://feeds.arstechnica.com/arstechnica/index"
)
$propertyFeeds = @(
"https://www.abc.net.au/news/feed/52278/rss.xml"
)
# Output HTML file
$outputFile = "C:\temp\DailyNews.html"
# Current date
$date = (Get-Date).ToString("dddd, MMM dd yyyy")
# Function to fetch feed items
function Get-FeedItems {
param($url)
Write-Host $url
try {
$rss = [xml](Invoke-WebRequest -Uri $url -UseBasicParsing -ErrorAction Stop).Content
$items = @()
foreach ($item in $rss.rss.channel.item | Select-Object -First 5) {
$items += [PSCustomObject]@{
Title = $item.title
Link = $item.link
PubDate = $item.pubDate
Source = $rss.rss.channel.title
}
}
return $items
} catch {
Write-Host "⚠️ Could not fetch: $url"
return @([PSCustomObject]@{
Title = "⚠️ Could not fetch"
Link = $url
PubDate = ""
Source = ""
})
}
}
# Fetch items
$techNews = @()
foreach ($feed in $techFeeds) {
$techNews += Get-FeedItems $feed
}
$propertyNews = @()
foreach ($feed in $propertyFeeds) {
$propertyNews += Get-FeedItems $feed
}
# Build HTML content
$html = @"
<html>
<head>
<title>📰 Daily Tech & Property News - $date</title>
<style>
body { font-family: Segoe UI, Arial; background: #f9fafb; color: #333; margin: 20px; }
h1, h2 { color: #2a7ae2; }
a { text-decoration: none; color: #0078d7; }
a:hover { text-decoration: underline; }
section { margin-bottom: 40px; }
.article { margin: 8px 0; }
footer { margin-top: 40px; font-size: 12px; color: #777; }
</style>
</head>
<body>
<h1>📰 Daily Tech & Property News</h1>
<p><b>Date:</b> $date</p>
<section>
<h2>🏠 Property News</h2>
<ul>
"@
foreach ($item in $propertyNews) {
$html += "<li class='article'><a href='$($item.Link)' target='_blank'>$($item.Title)</a></li>`n"
}
$html += @"
</ul>
</section>
<section>
<h2>💻 Tech News</h2>
<ul>
"@
foreach ($item in $techNews) {
$html += "<li class='article'><a href='$($item.Link)' target='_blank'>$($item.Title)</a></li>`n"
}
$html += @"
</ul>
</section>
<footer>Generated automatically by PowerShell – $date</footer>
</body></html>
"@
# Save HTML
$html | Out-File -FilePath $outputFile -Encoding utf8
Write-Host "✅ HTML News Summary saved to $outputFile"
Subscribe to:
Comments (Atom)