feedparser 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +2 -50
  3. data/README.md +71 -9
  4. data/Rakefile +1 -1
  5. data/lib/feedparser.rb +2 -0
  6. data/lib/feedparser/builder/microformats.rb +264 -0
  7. data/lib/feedparser/parser.rb +27 -0
  8. data/lib/feedparser/version.rb +2 -2
  9. data/test/helper.rb +3 -57
  10. data/test/test_microformats.rb +52 -0
  11. metadata +10 -56
  12. data/test/feeds/books/nostarch.rss +0 -125
  13. data/test/feeds/books/oreilly.feedburner.atom +0 -387
  14. data/test/feeds/books/pragprog.rss +0 -148
  15. data/test/feeds/byparker.json +0 -643
  16. data/test/feeds/daringfireball.atom +0 -1873
  17. data/test/feeds/daringfireball.json +0 -619
  18. data/test/feeds/googlegroups.atom +0 -37
  19. data/test/feeds/googlegroups2.atom +0 -27
  20. data/test/feeds/headius.atom +0 -123
  21. data/test/feeds/inessential.json +0 -182
  22. data/test/feeds/intertwingly.atom +0 -1197
  23. data/test/feeds/jsonfeed.json +0 -37
  24. data/test/feeds/lambdatheultimate.rss +0 -288
  25. data/test/feeds/learnenough.feedburner.atom +0 -747
  26. data/test/feeds/news/nytimes-blogs-bits.rss +0 -333
  27. data/test/feeds/news/nytimes-paul-krugman.rss +0 -60
  28. data/test/feeds/news/nytimes-tech.rss +0 -653
  29. data/test/feeds/news/nytimes-thomas-l-friedman.rss +0 -80
  30. data/test/feeds/news/nytimes.rss +0 -607
  31. data/test/feeds/news/washingtonpost-blogs-innovations.rss +0 -183
  32. data/test/feeds/news/washingtonpost-politics.rss +0 -35
  33. data/test/feeds/news/washingtonpost-world.rss +0 -29
  34. data/test/feeds/ongoing.atom +0 -1619
  35. data/test/feeds/osm/blog.openstreetmap.rss +0 -252
  36. data/test/feeds/osm/blogs.openstreetmap.rss +0 -585
  37. data/test/feeds/osm/mapbox.rss +0 -1883
  38. data/test/feeds/railstutorial.feedburner.atom +0 -656
  39. data/test/feeds/rubyflow.feedburner.rss +0 -120
  40. data/test/feeds/rubymine.feedburner.rss +0 -314
  41. data/test/feeds/rubyonrails.atom +0 -1241
  42. data/test/feeds/scripting.rss +0 -881
  43. data/test/feeds/sitepoint.rss +0 -218
  44. data/test/feeds/spec/atom/author.atom +0 -48
  45. data/test/feeds/spec/atom/authors.atom +0 -70
  46. data/test/feeds/spec/atom/categories.atom +0 -66
  47. data/test/feeds/spec/json/example.json +0 -36
  48. data/test/feeds/spec/json/microblog.json +0 -43
  49. data/test/feeds/spec/json/tags.json +0 -33
  50. data/test/feeds/spec/rss/author.rss +0 -41
  51. data/test/feeds/spec/rss/categories.rss +0 -64
  52. data/test/feeds/spec/rss/creator.rss +0 -38
  53. data/test/feeds/xkcd.atom +0 -48
  54. data/test/feeds/xkcd.rss +0 -55
  55. data/test/test_atom.rb +0 -27
  56. data/test/test_authors.rb +0 -26
  57. data/test/test_books.rb +0 -25
  58. data/test/test_feeds.rb +0 -29
  59. data/test/test_json.rb +0 -27
  60. data/test/test_rss.rb +0 -26
  61. data/test/test_tags.rb +0 -25
@@ -1,33 +0,0 @@
1
- {
2
- "version": "https://jsonfeed.org/version/1",
3
- "title": "My Example Feed",
4
- "home_page_url": "https://example.org/",
5
- "feed_url": "https://example.org/feed.json",
6
- "items": [
7
- {
8
- "id": "2",
9
- "content_text": "This is a second item.",
10
- "url": "https://example.org/second-item",
11
- "tags": ["one", "two", "fourty four"]
12
- },
13
- {
14
- "id": "1",
15
- "content_html": "<p>Hello, world!</p>",
16
- "url": "https://example.org/initial-post",
17
- "tags": ["compiler","dynamic dispatch","dynamic languages","ruby 2.0"]
18
- }
19
- ]
20
- }
21
-
22
- ---
23
-
24
- feed.items[0].tags.size: >>> 3
25
- feed.items[0].tags[0].name: one
26
- feed.items[0].tags[1].name: two
27
- feed.items[0].tags[2].name: fourty four
28
-
29
- feed.items[1].tags.size: >>> 4
30
- feed.items[1].tags[0].name: compiler
31
- feed.items[1].tags[1].name: dynamic dispatch
32
- feed.items[1].tags[2].name: dynamic languages
33
- feed.items[1].tags[3].name: ruby 2.0
@@ -1,41 +0,0 @@
1
- <?xml version="1.0"?>
2
- <rss version="2.0">
3
- <channel>
4
- <title>Test Author</title>
5
- <link>http://example.com/</link>
6
- <description/>
7
- <lastBuildDate>Mon, 29 May 2017 18:51:30 GMT </lastBuildDate>
8
- <managingEditor>Matt Flegenheimer Jr.</managingEditor>
9
- <webMaster>Matt Flegenheimer Sr.</webMaster>
10
- <item>
11
- <title>Jared Kushner&#x2019;s Role Is Tested as Russia Case Grows</title>
12
- <link>https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html?partner=rss&amp;emc=rss</link>
13
- <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html</guid>
14
- <pubDate>Mon, 29 May 2017 01:23:57 GMT</pubDate>
15
- <author>Peter Baker</author>
16
- </item>
17
- </channel>
18
- </rss>
19
-
20
- ---
21
-
22
- feed.authors.size: >>> 2
23
- feed.authors[0].text: Matt Flegenheimer Jr.
24
- feed.authors[0].to_s: Matt Flegenheimer Jr.
25
- feed.authors[0].email: >>> nil
26
- feed.authors[1].text: Matt Flegenheimer Sr.
27
- feed.authors[1].to_s: Matt Flegenheimer Sr.
28
-
29
- feed.author.text: Matt Flegenheimer Jr.
30
- feed.author.to_s: Matt Flegenheimer Jr.
31
- feed.author.email: >>> nil
32
-
33
-
34
- feed.items[0].authors.size: >>> 1
35
- feed.items[0].authors[0].text: Peter Baker
36
- feed.items[0].authors[0].to_s: Peter Baker
37
- feed.items[0].authors[0].email: >>> nil
38
-
39
- feed.items[0].author.text: Peter Baker
40
- feed.items[0].author.to_s: Peter Baker
41
- feed.items[0].author.email: >>> nil
@@ -1,64 +0,0 @@
1
- <?xml version="1.0"?>
2
- <rss version="2.0">
3
- <channel>
4
- <title>Test Categories</title>
5
- <link>http://example.com</link>
6
- <description/>
7
- <lastBuildDate>Mon, 29 May 2017 18:51:30 GMT </lastBuildDate>
8
- <category domain="http://www.nytimes.com/namespaces/keywords/des">United States Politics and Government</category>
9
- <category domain="http://www.nytimes.com/namespaces/keywords/des">Social Media</category>
10
- <category domain="http://www.nytimes.com/namespaces/keywords/mdes">News and News Media</category>
11
-
12
- <item>
13
- <title>Jared Kushner&#x2019;s Role Is Tested as Russia Case Grows</title>
14
- <link>https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html?partner=rss&amp;emc=rss</link>
15
- <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html</guid>
16
- <description>It is unclear how Jared Kushner&#x2019;s high-profile woes will affect his hard-won partnership with his father-in-law, perhaps the most stable in an often unstable White House.</description>
17
- <pubDate>Mon, 29 May 2017 01:23:57 GMT</pubDate>
18
- <category domain="http://www.nytimes.com/namespaces/keywords/mdes">Presidents and Presidency (US)</category>
19
- <category domain="http://www.nytimes.com/namespaces/keywords/des">Appointments and Executive Changes</category>
20
- <category domain="http://www.nytimes.com/namespaces/keywords/nyt_geo">United States</category>
21
- <category domain="http://www.nytimes.com/namespaces/keywords/nyt_per">Jared Kushner</category>
22
- <category domain="http://www.nytimes.com/namespaces/keywords/nyt_per">Donald J. Trump</category>
23
- </item>
24
-
25
- <item>
26
- <title>Reported Talks by Jared Kushner With Russia Would Be &#x2018;Good Thing,&#x2019; Trump Official Says</title>
27
- <link>https://www.nytimes.com/2017/05/28/us/politics/trump-returns-to-us-and-to-berating-newsmedia-on-twitter.html?partner=rss&amp;emc=rss</link>
28
- <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/politics/trump-returns-to-us-and-to-berating-newsmedia-on-twitter.html</guid>
29
- <description>John F. Kelly, the homeland security secretary, played down reports of a back channel. The president, meanwhile, resumed using Twitter as a weapon.</description>
30
- <pubDate>Sun, 28 May 2017 16:57:05 GMT</pubDate>
31
- <category domain="http://www.nytimes.com/namespaces/keywords/nyt_per">Trump, Donald J</category>
32
- <category domain="http://www.nytimes.com/namespaces/keywords/des">United States Politics and Government</category>
33
- <category domain="http://www.nytimes.com/namespaces/keywords/des">Social Media</category>
34
- <category domain="http://www.nytimes.com/namespaces/keywords/mdes">News and News Media</category>
35
- <category domain="http://www.nytimes.com/namespaces/keywords/nyt_org_all">Twitter</category>
36
- </item>
37
- </channel>
38
- </rss>
39
-
40
- ---
41
-
42
- feed.tags.size: >>> 3
43
- feed.tags[0].name: United States Politics and Government
44
- feed.tags[0].domain: http://www.nytimes.com/namespaces/keywords/des
45
- feed.tags[1].name: Social Media
46
- feed.tags[2].name: News and News Media
47
-
48
-
49
- feed.items[0].tags.size: >>> 5
50
- feed.items[0].tags[0].name: Presidents and Presidency (US)
51
- feed.items[0].tags[0].domain: http://www.nytimes.com/namespaces/keywords/mdes
52
- feed.items[0].tags[1].name: Appointments and Executive Changes
53
- feed.items[0].tags[2].name: United States
54
- feed.items[0].tags[3].name: Jared Kushner
55
- feed.items[0].tags[4].name: Donald J. Trump
56
-
57
-
58
- feed.items[1].tags.size: >>> 5
59
- feed.items[1].tags[0].name: Trump, Donald J
60
- feed.items[1].tags[0].domain: http://www.nytimes.com/namespaces/keywords/nyt_per
61
- feed.items[1].tags[1].name: United States Politics and Government
62
- feed.items[1].tags[2].name: Social Media
63
- feed.items[1].tags[3].name: News and News Media
64
- feed.items[1].tags[4].name: Twitter
@@ -1,38 +0,0 @@
1
- <?xml version="1.0"?>
2
- <rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
3
- <channel>
4
- <title>Test Dublin Core</title>
5
- <link>http://example.com/</link>
6
- <description/>
7
- <lastBuildDate>Mon, 29 May 2017 18:51:30 GMT </lastBuildDate>
8
- <dc:creator>Matt Flegenheimer</dc:creator>
9
- <item>
10
- <title>Jared Kushner&#x2019;s Role Is Tested as Russia Case Grows</title>
11
- <link>https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html?partner=rss&amp;emc=rss</link>
12
- <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html</guid>
13
- <pubDate>Mon, 29 May 2017 01:23:57 GMT</pubDate>
14
- <dc:creator>Peter Baker</dc:creator>
15
- </item>
16
- </channel>
17
- </rss>
18
-
19
- ---
20
-
21
- feed.authors.size: >>> 1
22
- feed.authors[0].text: Matt Flegenheimer
23
- feed.authors[0].to_s: Matt Flegenheimer
24
- feed.authors[0].email: >>> nil
25
-
26
- feed.author.text: Matt Flegenheimer
27
- feed.author.to_s: Matt Flegenheimer
28
- feed.author.email: >>> nil
29
-
30
-
31
- feed.items[0].authors.size: >>> 1
32
- feed.items[0].authors[0].text: Peter Baker
33
- feed.items[0].authors[0].to_s: Peter Baker
34
- feed.items[0].authors[0].email: >>> nil
35
-
36
- feed.items[0].author.text: Peter Baker
37
- feed.items[0].author.to_s: Peter Baker
38
- feed.items[0].author.email: >>> nil
@@ -1,48 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
3
- <title>xkcd.com</title>
4
- <link href="https://xkcd.com/" rel="alternate"></link>
5
- <id>https://xkcd.com/</id>
6
- <updated>2017-05-22T00:00:00Z</updated>
7
- <entry>
8
- <title>Genetic Testing Results</title>
9
- <link href="https://xkcd.com/1840/" rel="alternate"></link>
10
- <updated>2017-05-22T00:00:00Z</updated>
11
- <id>https://xkcd.com/1840/</id>
12
- <summary type="html">&lt;img src="https://imgs.xkcd.com/comics/genetic_testing_results.png" title="That's very exciting! The bad news is that it's a risk factor for a lot of things." alt="That's very exciting! The bad news is that it's a risk factor for a lot of things." /&gt;</summary>
13
- </entry>
14
- <entry>
15
- <title>Doctor Visit</title>
16
- <link href="https://xkcd.com/1839/" rel="alternate"></link>
17
- <updated>2017-05-19T00:00:00Z</updated>
18
- <id>https://xkcd.com/1839/</id>
19
- <summary type="html">&lt;img src="https://imgs.xkcd.com/comics/doctor_visit.png" title="According to these blood tests, you're like 30% cereal." alt="According to these blood tests, you're like 30% cereal." /&gt;</summary>
20
- </entry>
21
- <entry>
22
- <title>Machine Learning</title>
23
- <link href="https://xkcd.com/1838/" rel="alternate"></link>
24
- <updated>2017-05-17T00:00:00Z</updated>
25
- <id>https://xkcd.com/1838/</id>
26
- <summary type="html">&lt;img src="https://imgs.xkcd.com/comics/machine_learning.png" title="The pile gets soaked with data and starts to get mushy over time, so it's technically recurrent." alt="The pile gets soaked with data and starts to get mushy over time, so it's technically recurrent." /&gt;</summary>
27
- </entry>
28
- <entry>
29
- <title>Rental Car</title>
30
- <link href="https://xkcd.com/1837/" rel="alternate"></link>
31
- <updated>2017-05-15T00:00:00Z</updated>
32
- <id>https://xkcd.com/1837/</id>
33
- <summary type="html">&lt;img src="https://imgs.xkcd.com/comics/rental_car.png" title="Technically, both cars are haunted, but the murder ghosts can't stand listening to the broken GPS for more than a few minutes." alt="Technically, both cars are haunted, but the murder ghosts can't stand listening to the broken GPS for more than a few minutes." /&gt;</summary>
34
- </entry>
35
- </feed>
36
-
37
- ---
38
-
39
- feed.format: atom
40
- feed.title: xkcd.com
41
- feed.url: https://xkcd.com/
42
- feed.updated: >>> DateTime.new( 2017, 5, 22 )
43
- feed.items.size: >>> 4
44
-
45
- feed.items[0].title: Genetic Testing Results
46
- feed.items[0].url: https://xkcd.com/1840/
47
- feed.items[0].guid: https://xkcd.com/1840/
48
- feed.items[0].updated: >>> DateTime.new( 2017, 5, 22 )
@@ -1,55 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <rss version="2.0">
3
- <channel>
4
- <title>xkcd.com</title>
5
- <link>https://xkcd.com/</link>
6
- <description>xkcd.com: A webcomic of romance and math humor.</description>
7
- <language>en</language>
8
- <item>
9
- <title>Genetic Testing Results</title>
10
- <link>https://xkcd.com/1840/</link>
11
- <description>&lt;img src="https://imgs.xkcd.com/comics/genetic_testing_results.png" title="That's very exciting! The bad news is that it's a risk factor for a lot of things." alt="That's very exciting! The bad news is that it's a risk factor for a lot of things." /&gt;</description>
12
- <pubDate>Mon, 22 May 2017 04:00:00 -0000</pubDate>
13
- <guid>https://xkcd.com/1840/</guid>
14
- </item>
15
- <item>
16
- <title>Doctor Visit</title>
17
- <link>https://xkcd.com/1839/</link>
18
- <description>&lt;img src="https://imgs.xkcd.com/comics/doctor_visit.png" title="According to these blood tests, you're like 30% cereal." alt="According to these blood tests, you're like 30% cereal." /&gt;</description>
19
- <pubDate>Fri, 19 May 2017 04:00:00 -0000</pubDate>
20
- <guid>https://xkcd.com/1839/</guid>
21
- </item>
22
- <item>
23
- <title>Machine Learning</title>
24
- <link>https://xkcd.com/1838/</link>
25
- <description>&lt;img src="https://imgs.xkcd.com/comics/machine_learning.png" title="The pile gets soaked with data and starts to get mushy over time, so it's technically recurrent." alt="The pile gets soaked with data and starts to get mushy over time, so it's technically recurrent." /&gt;</description>
26
- <pubDate>Wed, 17 May 2017 04:00:00 -0000</pubDate>
27
- <guid>https://xkcd.com/1838/</guid>
28
- </item>
29
- <item>
30
- <title>Rental Car</title>
31
- <link>https://xkcd.com/1837/</link>
32
- <description>&lt;img src="https://imgs.xkcd.com/comics/rental_car.png" title="Technically, both cars are haunted, but the murder ghosts can't stand listening to the broken GPS for more than a few minutes." alt="Technically, both cars are haunted, but the murder ghosts can't stand listening to the broken GPS for more than a few minutes." /&gt;</description>
33
- <pubDate>Mon, 15 May 2017 04:00:00 -0000</pubDate>
34
- <guid>https://xkcd.com/1837/</guid>
35
- </item>
36
- </channel>
37
- </rss>
38
-
39
- ---
40
-
41
- feed.format: rss 2.0
42
- feed.title: xkcd.com
43
- feed.summary: xkcd.com: A webcomic of romance and math humor.
44
- feed.url: https://xkcd.com/
45
- feed.items.size: >>> 4
46
-
47
- feed.items[0].title: Genetic Testing Results
48
- feed.items[0].url: https://xkcd.com/1840/
49
- feed.items[0].guid: https://xkcd.com/1840/
50
- feed.items[0].updated: >>> DateTime.new( 2017, 5, 22, 4, 0 )
51
-
52
- feed.items[1].title: Doctor Visit
53
- feed.items[1].url: https://xkcd.com/1839/
54
- feed.items[1].guid: https://xkcd.com/1839/
55
- feed.items[1].updated: >>> DateTime.new( 2017, 5, 19, 4, 0 )
@@ -1,27 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_atom.rb
4
- # or better
5
- # rake test
6
-
7
- require 'helper'
8
-
9
-
10
- class TestAtom < MiniTest::Test
11
-
12
- def test_all
13
- names = [
14
- 'googlegroups.atom',
15
- 'googlegroups2.atom',
16
- 'rubyonrails.atom',
17
- 'railstutorial.feedburner.atom',
18
- 'headius.atom',
19
- ]
20
-
21
- names.each do |name|
22
- assert_feed_tests_for( name )
23
- end
24
- end
25
-
26
-
27
- end # class TestAtom
@@ -1,26 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_authors.rb
4
- # or better
5
- # rake test
6
-
7
- require 'helper'
8
-
9
-
10
- class TestAuthors < MiniTest::Test
11
-
12
- def test_all
13
- names = [
14
- 'spec/atom/author.atom',
15
- 'spec/atom/authors.atom',
16
- 'spec/rss/creator.rss',
17
- 'spec/rss/author.rss',
18
- ]
19
-
20
- names.each do |name|
21
- assert_feed_tests_for( name )
22
- end
23
- end
24
-
25
-
26
- end # class TestAuthors
@@ -1,25 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_books.rb
4
- # or better
5
- # rake test
6
-
7
- require 'helper'
8
-
9
-
10
- class TestBooks < MiniTest::Test
11
-
12
- def test_all
13
- names = [
14
- 'books/nostarch.rss',
15
- 'books/pragprog.rss',
16
- 'books/oreilly.feedburner.atom',
17
- ]
18
-
19
- names.each do |name|
20
- assert_feed_tests_for( name )
21
- end
22
- end
23
-
24
-
25
- end # class TestBooks
@@ -1,29 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_feeds.rb
4
- # or better
5
- # rake test
6
-
7
- require 'helper'
8
-
9
-
10
- class TestFeeds < MiniTest::Test
11
-
12
- def test_all
13
- names = [
14
- 'learnenough.feedburner.atom',
15
- 'xkcd.atom',
16
- 'xkcd.rss',
17
- 'daringfireball.atom',
18
- 'intertwingly.atom',
19
- 'ongoing.atom',
20
- 'scripting.rss',
21
- ]
22
-
23
- names.each do |name|
24
- assert_feed_tests_for( name )
25
- end
26
- end
27
-
28
-
29
- end # class TestFeeds
@@ -1,27 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_json.rb
4
- # or better
5
- # rake test
6
-
7
- require 'helper'
8
-
9
-
10
- class TestJson < MiniTest::Test
11
-
12
- def test_all
13
- names = [
14
- 'jsonfeed.json',
15
- 'byparker.json',
16
- 'daringfireball.json',
17
- 'inessential.json',
18
- 'spec/json/example.json',
19
- 'spec/json/microblog.json',
20
- ]
21
-
22
- names.each do |name|
23
- assert_feed_tests_for( name )
24
- end
25
- end
26
-
27
- end # class TestJson
@@ -1,26 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_rss.rb
4
- # or better
5
- # rake test
6
-
7
- require 'helper'
8
-
9
-
10
- class TestRss < MiniTest::Test
11
-
12
- def test_all
13
- names = [
14
- 'rubyflow.feedburner.rss',
15
- 'sitepoint.rss',
16
- 'lambdatheultimate.rss',
17
- 'rubymine.feedburner.rss',
18
- ]
19
-
20
- names.each do |name|
21
- assert_feed_tests_for( name )
22
- end
23
- end
24
-
25
-
26
- end # class TestRss