rust-syndication / Rss

Licence: other
Library for serializing the RSS web content syndication format

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Rss

Gofeed
Parse RSS, Atom and JSON feeds in Go
Stars: ✭ 1,762 (+690.13%)
Mutual labels:  rss, parser, feed
Atoma
Atom, RSS and JSON feed parser for Python 3
Stars: ✭ 67 (-69.96%)
Mutual labels:  rss, parser, feed
Picofeed
PHP library to parse and write RSS/Atom feeds
Stars: ✭ 439 (+96.86%)
Mutual labels:  rss, parser, feed
Rss Atom Bundle
RSS and Atom Bundle for Symfony
Stars: ✭ 123 (-44.84%)
Mutual labels:  rss, feed
Poddycast
Podcast app made with Electron, lots of ❤️ and ☕️
Stars: ✭ 111 (-50.22%)
Mutual labels:  rss, feed
Rssfs
The RSS file system (Git mirror)
Stars: ✭ 115 (-48.43%)
Mutual labels:  rss, feed
Awesome Rss
Puts an RSS/Atom subscribe button back in URL bar
Stars: ✭ 125 (-43.95%)
Mutual labels:  rss, feed
Feedparser
feedparser gem - (universal) web feed parser and normalizer (XML w/ Atom or RSS, JSON Feed, HTML w/ Microformats e.g. h-entry/h-feed or Feed.HTML, Feed.TXT w/ YAML, JSON or INI & Markdown, etc.)
Stars: ✭ 156 (-30.04%)
Mutual labels:  rss, feed
Planetxamarin
We are an aggregator of content from Xamarin Community members. Why subscribe individually when you can subscribe to one convenient RSS feed, to see all the content generated by the community members in you news reader.
Stars: ✭ 158 (-29.15%)
Mutual labels:  rss, feed
Pluto
pluto gems - planet feed reader and (static) website generator - auto-build web pages from published web feeds
Stars: ✭ 174 (-21.97%)
Mutual labels:  rss, feed
Feedjira
A feed parsing library
Stars: ✭ 2,017 (+804.48%)
Mutual labels:  rss, parser
Feed Module
Everyone deserves RSS, ATOM and JSON feeds!
Stars: ✭ 182 (-18.39%)
Mutual labels:  rss, feed
Simplepie
A simple Atom/RSS parsing library for PHP.
Stars: ✭ 1,389 (+522.87%)
Mutual labels:  rss, parser
Genrss
genRSS generates a RSS 2 feed from media files in a directory
Stars: ✭ 69 (-69.06%)
Mutual labels:  rss, feed
Feedbag
Ruby's favorite feed auto-discovery library/tool
Stars: ✭ 115 (-48.43%)
Mutual labels:  rss, feed
Mautic Rss To Email Bundle
Mautic plugin to send emails from RSS
Stars: ✭ 69 (-69.06%)
Mutual labels:  rss, feed
Discord feedbot
Moved to https://gitlab.com/ffreiheit/discord_feedbot
Stars: ✭ 67 (-69.96%)
Mutual labels:  rss, feed
Winds
A Beautiful Open Source RSS & Podcast App Powered by Getstream.io
Stars: ✭ 8,530 (+3725.11%)
Mutual labels:  rss, feed
Feedek
FeedEk jQuery RSS/ATOM Feed Plugin
Stars: ✭ 190 (-14.8%)
Mutual labels:  rss, feed
Posidonlauncher
a one-page homescreen with a news feed
Stars: ✭ 163 (-26.91%)
Mutual labels:  rss, feed

rss

Build status Codecov crates.io Docs

Library for deserializing and serializing the RSS web content syndication format.

Supported Versions

Reading from the following RSS versions is supported:

  • RSS 0.90
  • RSS 0.91
  • RSS 0.92
  • RSS 1.0
  • RSS 2.0

Writing support is limited to RSS 2.0.

Documentation

Usage

Add the dependency to your Cargo.toml.

[dependencies]
rss = "1.0"

Reading

A channel can be read from any object that implements the BufRead trait.

From a file

use std::fs::File;
use std::io::BufReader;
use rss::Channel;

let file = File::open("example.xml").unwrap();
let channel = Channel::read_from(BufReader::new(file)).unwrap();

From a buffer

Note: This example requires reqwest crate.

use std::error::Error;
use rss::Channel;

async fn example_feed() -> Result<Channel, Box<dyn Error>> {
    let content = reqwest::get("http://example.com/feed.xml")
        .await?
        .bytes()
        .await?;
    let channel = Channel::read_from(&content[..])?;
    Ok(channel)
}

Writing

A channel can be written to any object that implements the Write trait or converted to an XML string using the ToString trait.

Note: Writing a channel does not perform any escaping of XML entities.

use rss::Channel;

let channel = Channel::default();
channel.write_to(::std::io::sink()).unwrap(); // // write to the channel to a writer
let string = channel.to_string(); // convert the channel to a string

Creation

Builder methods are provided to assist in the creation of channels.

Note: This requires the builders feature, which is enabled by default.

use rss::ChannelBuilder;

let channel = ChannelBuilder::default()
    .title("Channel Title")
    .link("http://example.com")
    .description("An RSS feed.")
    .build()
    .unwrap();

Validation

Validation methods are provided to validate the contents of a channel against the RSS specification.

Note: This requires enabling the validation feature.

use rss::Channel;
use rss::validation::Validate;

let channel = Channel::default();
channel.validate().unwrap();

Extensions

Elements which have non-default namespaces will be considered extensions. Extensions are stored in Channel.extensions and Item.extensions.

For conveninence, Dublin Core, Syndication and iTunes extensions are extracted to structs and stored in as properties on channels and items.

Invalid Feeds

As a best effort to parse invalid feeds rss will default elements declared as "required" by the RSS 2.0 specification to an empty string.

License

Licensed under either of

at your option.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].