#atom #blog #feed #rss

syndication

Library for serializing Atom and RSS web feeds

6 releases (breaking)

Uses old Rust 2015

0.5.0 Oct 26, 2019
0.4.0 Oct 19, 2016
0.3.0 Sep 20, 2016
0.2.0 Jun 6, 2016
0.1.0 Sep 9, 2015

#14 in #feed

Download history 31/week @ 2023-10-24 38/week @ 2023-10-31 29/week @ 2023-11-07 23/week @ 2023-11-14 35/week @ 2023-11-21 36/week @ 2023-11-28 31/week @ 2023-12-05 32/week @ 2023-12-12 30/week @ 2023-12-19 32/week @ 2023-12-26 24/week @ 2024-01-02 32/week @ 2024-01-09 22/week @ 2024-01-16 23/week @ 2024-01-23 28/week @ 2024-01-30 23/week @ 2024-02-06

100 downloads per month
Used in 2 crates

MIT/Apache

11KB
91 lines

rust-syndication

Cargo Version Build Status

Library for serializing Atom and RSS web feeds. Wraps around rust-atom and rust-rss.

Usage

Reading

let atom_str = r#"
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>urn:uuid:b3420f84-6bdf-4f46-a225-f1b9a14703b6</id>
  <title>TechCrunch</title>
  <updated>2019-04-01T07:30:00Z</updated>
  <entry>
    <id>urn:uuid:4ae8550b-2987-49fa-9f8c-54c180c418ac</id>
    <title>Ford hires Elon Musk as CEO</title>
    <updated>2019-04-01T07:30:00Z</updated>
  </entry>
</feed>
"#;

match atom_str.parse::<Feed>().unwrap() {
    Feed::Atom(atom_feed) => println!("Atom feed first entry: {:?}", atom_feed.entries[0].title),
    _ => {}
};

let rss_str = r#"
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>TechCrunch</title>
    <link>http://techcrunch.com</link>
    <description>The latest technology news and information on startups</description>
    <item>
      <title>Ford hires Elon Musk as CEO</title>
      <pubDate>01 Apr 2019 07:30:00 GMT</pubDate>
      <description>In an unprecedented move, Ford hires Elon Musk.</description>
    </item>
  </channel>
</rss>
"#;

match rss_str.parse::<Feed>().unwrap() {
    Feed::RSS(rss_feed) => println!("RSS feed first entry: {:?}",
        rss_feed.items[0].title),
    _ => {}
};

Writing

Currently not supported.

Todo

  • Parse feeds into common format.
  • Support writing feeds.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~7MB
~189K SLoC