FeedReader

arminreiterMIT活跃维护

C# 编写的 RSS/Atom 订阅解析库,兼容 RSS 0.91 到 2.0、ATOM 1.0/0.3 及 JSON Feed,还支持 iTunes 与 Podcasting 2.0 扩展,省去自己处理各种订阅格式差异的麻烦。

C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0, ATOM (1.0 and 0.3) and JSON Feed (1.0 and 1.1), plus the iTunes and Podcasting 2.0 extensions. Tested with multiple languages and feeds.

v2.1.1发布于 2026-11-04 17:25 UTC332star +1 / 7 天75fork同步于 2026-11-10 18:02 UTC

怎么上手

由 README 提炼,执行前请确认
dotnet add package CodeHollow.FeedReader
硬件要求按 README 说明

README 未说明,纯 .NET 库,无 GPU 或显存要求

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

C# 的 RSS/ATOM/JSON Feed 解析库,解决多语言、多编码源解析不稳的问题

C# 编写的 RSS/Atom 订阅解析库,兼容 RSS 0.91 到 2.0、ATOM 1.0/0.3 及 JSON Feed,还支持 iTunes 与 Podcasting 2.0 扩展,省去自己处理各种订阅格式差异的麻烦。

核心能力

  • 支持 RSS 0.91/0.92/1.0/2.0、ATOM 1.0/0.3 与 JSON Feed 1.0/1.1
  • 通过 SpecificFeed 强类型对象读取各格式独有字段
  • 用扩展方法解析 iTunes 与 Podcasting 2.0 播客标签
  • GetFeedUrlsFromUrl 从网页 HTML 自动发现订阅地址
  • 异步 ReadAsync 一行读取并遍历条目

容易踩的坑

库使用 SHA1 强名称签名,Fedora/RHEL 等禁用 SHA1 的发行版需改用 build/pack.sh 打包;发布流程不会自动跑测试,需手动执行 dotnet test FeedReader.Tests;部分字段仅在特定格式中存在,需先判断 feed.Type 再取 SpecificFeed

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

2 个版本v2.1.1
  1. v2.1.12.1.1最新正式版2026-11-04 · 2026-11-04 17:25 UTC
  2. v2.1.02.1.02026-11-04 · 2026-11-04 17:13 UTC
    查看更新说明

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    FeedReader

    NuGet

    FeedReader is a .net library used for reading and parsing RSS, ATOM and JSON feeds. Supports RSS 0.91, 0.92, 1.0, 2.0, ATOM (1.0 and 0.3) and JSON Feed (1.0 and 1.1), plus the iTunes and Podcasting 2.0 (podcast:) podcast extensions. Developed because tested existing libraries do not work with different languages, encodings or have other issues. Library tested with multiple languages, encodings and feeds.

    FeedReader library is available as NuGet package: https://www.nuget.org/packages/CodeHollow.FeedReader/

    Usage

    The simplest way to read a feed and show the information is:

        var feed = await FeedReader.ReadAsync("https://arminreiter.com/feed");
    
        Console.WriteLine("Feed Title: " + feed.Title);
        Console.WriteLine("Feed Description: " + feed.Description);
        Console.WriteLine("Feed Image: " + feed.ImageUrl);
        // ...
        foreach(var item in feed.Items)
        {
            Console.WriteLine(item.Title + " - " + item.Link);
        }
    

    There are some properties that are only available in e.g. RSS 2.0. If you want to get those properties, the property "SpecificFeed" is the right one:

        var feed = await FeedReader.ReadAsync("https://arminreiter.com/feed");
    
        Console.WriteLine("Feed Title: " + feed.Title);
                
        if(feed.Type == FeedType.Rss_2_0)
        {
            var rss20feed = (Feeds.Rss20Feed)feed.SpecificFeed;
            Console.WriteLine("Generator: " + rss20feed.Generator);
        }
    

    Podcast feeds: the iTunes and Podcasting 2.0 tags are available via extension methods:

        using CodeHollow.FeedReader.Feeds.Itunes;
        using CodeHollow.FeedReader.Feeds.Podcast;
    
        var feed = await FeedReader.ReadAsync("https://feeds.podcastindex.org/pc20.xml");
        var podcast = feed.GetPodcastChannel();              // podcast:guid, locked, funding, person, ...
        Console.WriteLine("Guid: " + podcast.Guid);
    
        foreach (var item in feed.Items)
        {
            var episode = item.GetPodcastItem();             // podcast:transcript, chapters, season, episode, ...
            Console.WriteLine(item.Title + " - transcripts: " + episode.Transcripts.Length);
        }
    

    If the url to the feed is not known, then you can use FeedReader.GetFeedUrlsFromUrl(url) to parse the url from the html webpage:

        string url = "arminreiter.com";
        var urls = FeedReader.GetFeedUrlsFromUrl(url);
                
        string feedUrl;
        if (urls.Count() < 1) // no url - probably the url is already the right feed url
            feedUrl = url;
        else if (urls.Count() == 1)
            feedUrl = urls.First().Url;
        else if (urls.Count() == 2) // if 2 urls, then its usually a feed and a comments feed, so take the first per default
            feedUrl = urls.First().Url;
        else
        {
            // show all urls and let the user select (or take the first or ...)
            // ...
        }
    
        var readerTask = FeedReader.ReadAsync(feedUrl);
        readerTask.ConfigureAwait(false);
    
        foreach (var item in readerTask.Result.Items)
        {
            Console.WriteLine(item.Title + " - " + item.Link);
            // ...
        }
    

    The code contains a sample console application: https://github.com/codehollow/FeedReader/tree/master/FeedReader.ConsoleSample

    Build & Test

    dotnet test FeedReader.Tests
    

    The library is strong-name signed with key.snk (SHA1). Distros that block SHA1 signatures (e.g. Fedora/RHEL) fail the signed build with invalid digest. To build the signed NuGet package on Linux (output: artifacts/):

    build/pack.sh
    

    Specifications

    Release

    dotnet test FeedReader.Tests   # workflow doesn't run tests
    build/release.sh 2.1.0         # needs clean working tree
    

    Bumps <Version> in the csproj, commits, tags v2.1.0 and pushes. The tag push runs .github/workflows/release.yml: pack → nuget.org (Trusted Publishing, repo secret NUGET_USER) → GitHub release with the .nupkg attached.