Crate feedfinder[−][src]
feedfinder
The feedfinder
crate is for auto-discovering RSS, Atom, JSON feeds from the content of a
page.
You supply the primary function detect_feeds with the content of a HTML page and the URL of that page and it returns a list of possible feeds.
About
feedfiner
can find feeds from these sources:
- Linked via the
<link>
tag in the HTML - Linked via
<a>
tag in the HTML - By guessing from the software used to generate the page:
- Tumblr
- WordPress
- Hugo
- Jekyll
- Ghost
- From YouTube:
- channels
- playlists
- users
Getting Started
Add dependencies to Cargo.toml
:
feedfinder = "0.1"
Example
This example detects the feed linked via the <link>
tag in the HTML.
extern crate feedfinder; extern crate url; use feedfinder::detect_feeds; use url::Url; fn main() { let url = Url::parse("https://example.com/example").expect("unable to parse url"); let html = r#" <html> <head> <title>Example</title> <link rel="alternate" href="/posts.rss" type="application/rss+xml" /> </head> <body> My fun page with a feed. </body> </html>"#; match detect_feeds(&url, html) { Ok(feeds) => { println!("Possible feeds for {}", url); for feed in feeds { println!("{:?}", feed); } } Err(err) => println!("Unable to find feeds due to error: {}", err), } }
Structs
Feed |
Enums
FeedFinderError | |
FeedType |
Functions
detect_feeds |
Find feeds in the supplied content. |