Skip to content

Instantly share code, notes, and snippets.

@wipiano
Created August 12, 2022 00:46
Show Gist options
  • Save wipiano/46310e0150483626f1e532e83fd7566c to your computer and use it in GitHub Desktop.
Save wipiano/46310e0150483626f1e532e83fd7566c to your computer and use it in GitHub Desktop.
techradar
// See https://aka.ms/new-console-template for more information
using System.Text;
using CodeHollow.FeedReader;
const int readCountPerFeed = 10;
string[] sites = new[]
{
"https://feed.infoq.com/",
"http://feeds.dzone.com/home",
"https://news.content.smithbucklin.com/acm/TechNews.xml",
"https://cacm.acm.org/news.rss",
"https://cacm.acm.org/blogs/blog-cacm.rss",
"https://cacm.acm.org/opinion.rss",
"https://dev.classmethod.jp/feed/",
"https://aws.amazon.com/jp/blogs/news/feed/",
"https://cloudblog.withgoogle.com/rss",
"https://azurecomcdn.azureedge.net/ja-jp/blog/feed/",
"https://martinfowler.com/feed.atom",
"https://www.joelonsoftware.com/feed/",
"https://www.developertoarchitect.com/index.xml",
"https://weekref.net/feed.atom",
"https://blog.jetbrains.com/feed/",
"https://www.publickey1.jp/atom.xml",
};
Console.OutputEncoding = Encoding.UTF8;
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
foreach (var site in sites)
{
try
{
var items = (await FeedReader.ReadAsync(site))
.Items
.OrderByDescending(x => x.PublishingDate)
.Take(readCountPerFeed)
.ToArray();
var item = items[Random.Shared.Next(0, items.Length - 1)];
Console.WriteLine($"{item.Title} ({item.PublishingDateString}): {item.Link}");
}
catch (Exception e)
{
Console.WriteLine($"skipped: {site}");
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CodeHollow.FeedReader" Version="1.2.4" />
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment