1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright (c) 2015-2016 Chris Palmer <pennstate5013@gmail.com>
// Use of this source code is governed by the LGPLv3 license that can be
// found in the LICENSE file.
//! # feed 2.0
//!
//! This Library is for parsing through a channels field and creating a `Feed`
//! struct containing all elements of a `Channel` based on the channels spec.
//!
//! ## Usage
//! Put this in your Cargo.toml:
//!
//! ```Toml
//! [dependencies]
//! feed = "2.0"
//! ```
//!
//! And put this in your crate root:
//!
//! ```
//! extern crate feed;
//! ```
//!
//! ## Examples
//!
//! ### Reading Feeds
//!
//! ```
//! extern crate feed;
//! extern crate url;
//!
//! use feed::FeedBuilder;
//!
//! fn main() {
//! let url_str = "https://feedpress.me/usererror.xml";
//! let feed = FeedBuilder::read_from_url(url_str).finalize();
//! let channel = feed.channel();
//! println!("Title: {}", channel.title());
//! }
//! ```
//!
//! ### Writing Feeds
//!
//! ```
//! extern crate feed;
//!
//! use feed::FeedBuilder;
//! use feed::channels::ChannelBuilder;
//!
//! fn main() {
//!
//! let description = "Ogg Vorbis audio versions of The Linux ".to_owned()
//! + "Action Show! A show that covers everything geeks care about in "
//! + "the computer industry. Get a solid dose of Linux, gadgets, news "
//! + "events and much more!";
//!
//! let channel = ChannelBuilder::new()
//! .title("The Linux Action Show! OGG")
//! .link("http://www.jupiterbroadcasting.com")
//! .description(description.as_ref())
//! .finalize();
//! let feed = FeedBuilder::channel(channel).finalize();
//! let xml = feed.to_xml();
//! println!("Feed: {:?}", xml);
//! }
//! ```
extern crate chrono;
extern crate curl;
extern crate mime;
extern crate rss;
extern crate url;
use Channel;
/// This `Feed` struct contains all the items that exist for the feeds.
/// This `FeedBuilder` struct creates the Feed struct from url, file, or &str.