#feed #rss #atom #json #json-feed

feed-rs

A unified feed parser that handles Atom, RSS 2.0, RSS 1.0, RSS 0.x and JSON Feed

27 releases (10 stable)

2.0.0 May 27, 2024
1.5.3 May 26, 2024
1.4.0 Jan 10, 2024
1.3.0 Feb 10, 2023
0.1.3 Jul 7, 2017

#2 in #rss

Download history 1221/week @ 2024-03-01 2541/week @ 2024-03-08 4482/week @ 2024-03-15 2026/week @ 2024-03-22 1574/week @ 2024-03-29 1322/week @ 2024-04-05 1120/week @ 2024-04-12 1547/week @ 2024-04-19 1348/week @ 2024-04-26 1812/week @ 2024-05-03 2155/week @ 2024-05-10 1497/week @ 2024-05-17 1485/week @ 2024-05-24 2204/week @ 2024-05-31 1388/week @ 2024-06-07 882/week @ 2024-06-14

6,079 downloads per month
Used in 31 crates (27 directly)

MIT license

240KB
4K SLoC

feed-rs

Build Status Crates.io Status

Library for parsing various forms of feeds such as Atom, RSS and JSON Feed. It also supports extensions such as iTunes, Dublin Core and Media RSS and serialisation/deserialisation via serde.

Documentation

Usage

Add the dependency to your Cargo.toml.

[dependencies]
feed-rs = "2.0.0"

Reading

A feed can be parsed from any object that implements the Read trait.

use feed_rs::parser;
let xml = r#"
<feed>
   <title type="text">sample feed</title>
   <updated>2005-07-31T12:29:29Z</updated>
   <id>feed1</id>
   <entry>
       <title>sample entry</title>
       <id>entry1</id>
   </entry>
</feed>
"#;
let feed = parser::parse(xml.as_bytes()).unwrap();

The parser will automatically detect XML vs. JSON so parsing JSON Feed content works the same way.

use feed_rs::parser;
let json = r#"
{
  "version": "https://jsonfeed.org/version/1",
  "title": "JSON Feed",
  "description": "JSON Feed is a pragmatic syndication format for blogs, microblogs, and other time-based content.",
  "home_page_url": "https://jsonfeed.org/",
  "feed_url": "https://jsonfeed.org/feed.json",
  "author": {
    "name": "Brent Simmons and Manton Reece",
    "url": "https://jsonfeed.org/"
  },
  "items": [
    {
      "title": "Announcing JSON Feed",
      "date_published": "2017-05-17T08:02:12-07:00",
      "id": "https://jsonfeed.org/2017/05/17/announcing_json_feed",
      "url": "https://jsonfeed.org/2017/05/17/announcing_json_feed",
      "content_html": "<p>We — Manton Reece and Brent Simmons — have noticed that JSON...</p>"
    }
  ]
}"#;
let feed = parser::parse(json.as_bytes()).unwrap();

License

MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

Contribution

Any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.

Dependencies

~12MB
~299K SLoC