Skip to content

Commit

Permalink
fix(parser): missing author field
Browse files Browse the repository at this point in the history
fix(parser): author is optional at parsing, fallback at rendering
feat(date): support weeks_ago
test(parser): add tests from sample-feeds.com
  • Loading branch information
neo451 committed Feb 23, 2025
1 parent bd513db commit 89cfff3
Show file tree
Hide file tree
Showing 30 changed files with 1,751 additions and 258 deletions.
198 changes: 198 additions & 0 deletions data/sample/apple_podcast.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Hiking Treks</title>
<link>https://www.apple.com/itunes/podcasts/</link>
<language>en-us</language>
<copyright>&#169; 2020 John Appleseed</copyright>
<itunes:author>The Sunset Explorers</itunes:author>
<description>
Love to get outdoors and discover nature&apos;s treasures? Hiking Treks is the
show for you. We review hikes and excursions, review outdoor gear and interview
a variety of naturalists and adventurers. Look for new episodes each week.
</description>
<itunes:type>serial</itunes:type>
<itunes:owner>
<itunes:name>Sunset Explorers</itunes:name>
<itunes:email>[email protected]</itunes:email>
</itunes:owner>
<itunes:image
href="https://applehosted.podcasts.apple.com/hiking_treks/artwork.png"
/>
<itunes:category text="Sports">
<itunes:category text="Wilderness"/>
</itunes:category>
<itunes:explicit>false</itunes:explicit>
<item>
<itunes:episodeType>trailer</itunes:episodeType>
<itunes:title>Hiking Treks Trailer</itunes:title>
<description>
<![CDATA[The Sunset Explorers share tips, techniques and recommendations for
great hikes and adventures around the United States. Listen on
<a href="https://www.apple.com/itunes/podcasts/">Apple Podcasts</a>.]]>
</description>
<enclosure
length="498537"
type="audio/mpeg"
url="http://example.com/podcasts/everything/AllAboutEverythingEpisode4.mp3"
/>
<guid>aae20190418</guid>
<pubDate>Tue, 8 Jan 2019 01:15:00 GMT</pubDate>
<itunes:duration>1079</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>4</itunes:episode>
<itunes:season>2</itunes:season>
<title>S02 EP04 Mt. Hood, Oregon</title>
<description>
Tips for trekking around the tallest mountain in Oregon
</description>
<enclosure
length="8727310"
type="audio/x-m4a"
url="http://example.com/podcasts/everything/mthood.m4a"
/>
<guid>aae20190606</guid>
<pubDate>Tue, 07 May 2019 12:00:00 GMT</pubDate>
<itunes:duration>1024</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>3</itunes:episode>
<itunes:season>2</itunes:season>
<title>S02 EP03 Bouldering Around Boulder</title>
<description>
We explore fun walks to climbing areas about the beautiful Colorado city of Boulder.
</description>
<itunes:image
href="http://example.com/podcasts/everything/AllAboutEverything/Episode2.jpg"
/>
<link>href="http://example.com/podcasts/everything/</link>
<enclosure
length="5650889"
type="video/mp4"
url="http://example.com/podcasts/boulder.mp4"
/>
<guid>aae20190530</guid>
<pubDate>Tue, 30 Apr 2019 13:00:00 EST</pubDate>
<itunes:duration>3627</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>2</itunes:episode>
<itunes:season>2</itunes:season>
<title>S02 EP02 Caribou Mountain, Maine</title>
<description>
Put your fitness to the test with this invigorating hill climb.
</description>
<itunes:image
href="http://example.com/podcasts/everything/AllAboutEverything/Episode3.jpg"
/>
<enclosure
length="5650889"
type="audio/x-m4v"
url="http://example.com/podcasts/everything/caribou.m4v"
/>
<guid>aae20190523</guid>
<pubDate>Tue, 23 May 2019 02:00:00 -0700</pubDate>
<itunes:duration>2434</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>1</itunes:episode>
<itunes:season>2</itunes:season>
<title>S02 EP01 Stawamus Chief</title>
<description>
We tackle Stawamus Chief outside of Vancouver, BC and you should too!
</description>
<enclosure
length="498537"
type="audio/mpeg"
url="http://example.com/podcasts/everything/AllAboutEverythingEpisode4.mp3"
/>
<guid>aae20190516</guid>
<pubDate>2019-02-16T07:00:00.000Z</pubDate>
<itunes:duration>13:24</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>4</itunes:episode>
<itunes:season>1</itunes:season>
<title>S01 EP04 Kuliouou Ridge Trail</title>
<description>
Oahu, Hawaii, has some picturesque hikes and this is one of the best!
</description>
<enclosure
length="498537"
type="audio/mpeg"
url="http://example.com/podcasts/everything/AllAboutEverythingEpisode4.mp3"
/>
<guid>aae20190509</guid>
<pubDate>Tue, 27 Nov 2018 01:15:00 +0000</pubDate>
<itunes:duration>929</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>3</itunes:episode>
<itunes:season>1</itunes:season>
<title>S01 EP03 Blood Mountain Loop</title>
<description>
Hiking the Appalachian Trail and Freeman Trail in Georgia
</description>
<enclosure
length="498537"
type="audio/mpeg"
url="http://example.com/podcasts/everything/AllAboutEverythingEpisode4.mp3"
/>
<guid>aae20190502</guid>
<pubDate>Tue, 23 Oct 2018 01:15:00 +0000</pubDate>
<itunes:duration>1440</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>2</itunes:episode>
<itunes:season>1</itunes:season>
<title>S01 EP02 Garden of the Gods Wilderness</title>
<description>
Wilderness Area Garden of the Gods in Illinois is a delightful spot for
an extended hike.
</description>
<enclosure
length="498537"
type="audio/mpeg"
url="http://example.com/podcasts/everything/AllAboutEverythingEpisode4.mp3"
/>
<guid>aae20190425</guid>
<pubDate>Tue, 18 Sep 2018 01:15:00 +0000</pubDate>
<itunes:duration>839</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:episode>1</itunes:episode>
<itunes:season>1</itunes:season>
<title>S01 EP01 Upper Priest Lake Trail to Continental Creek Trail</title>
<description>
We check out this powerfully scenic hike following the river in the Idaho
Panhandle National Forests.
</description>
<enclosure
length="498537"
type="audio/mpeg"
url="http://example.com/podcasts/everything/AllAboutEverythingEpisode4.mp3"
/>
<guid>aae20190418a</guid>
<pubDate>Tue, 14 Aug 2018 01:15:00 +0000</pubDate>
<itunes:duration>1399</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
</channel>
</rss>
19 changes: 19 additions & 0 deletions data/sample/atom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<link href="http://example.org/"/>
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>John Doe</name>
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>

<entry>
<title>Atom-Powered Robots Run Amok</title>
<link href="http://example.org/2003/12/13/atom03"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
<summary>Some text.</summary>
</entry>

</feed>
151 changes: 151 additions & 0 deletions data/sample/feedforall.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="windows-1252"?>
<rss version="2.0">
<channel>
<title>FeedForAll Sample Feed</title>
<description>RSS is a fascinating technology. The uses for RSS are expanding daily. Take a closer look at how various industries are using the benefits of RSS in their businesses.</description>
<link>http://www.feedforall.com/industry-solutions.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<copyright>Copyright 2004 NotePage, Inc.</copyright>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<language>en-us</language>
<lastBuildDate>Tue, 19 Oct 2004 13:39:14 -0400</lastBuildDate>
<managingEditor>[email protected]</managingEditor>
<pubDate>Tue, 19 Oct 2004 13:38:55 -0400</pubDate>
<webMaster>[email protected]</webMaster>
<generator>FeedForAll Beta1 (0.0.1.8)</generator>
<image>
<url>http://www.feedforall.com/ffalogo48x48.gif</url>
<title>FeedForAll Sample Feed</title>
<link>http://www.feedforall.com/industry-solutions.htm</link>
<description>FeedForAll Sample Feed</description>
<width>48</width>
<height>48</height>
</image>
<item>
<title>RSS Solutions for Restaurants</title>
<description>&lt;b&gt;FeedForAll &lt;/b&gt;helps Restaurant&apos;s communicate with customers. Let your customers know the latest specials or events.&lt;br&gt;
&lt;br&gt;
RSS feed uses include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#FF0000&quot;&gt;Daily Specials &lt;br&gt;
Entertainment &lt;br&gt;
Calendar of Events &lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/restaurant.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:09:11 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Schools and Colleges</title>
<description>FeedForAll helps Educational Institutions communicate with students about school wide activities, events, and schedules.&lt;br&gt;
&lt;br&gt;
RSS feed uses include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#0000FF&quot;&gt;Homework Assignments &lt;br&gt;
School Cancellations &lt;br&gt;
Calendar of Events &lt;br&gt;
Sports Scores &lt;br&gt;
Clubs/Organization Meetings &lt;br&gt;
Lunches Menus &lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/schools.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:09:09 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Computer Service Companies</title>
<description>FeedForAll helps Computer Service Companies communicate with clients about cyber security and related issues. &lt;br&gt;
&lt;br&gt;
Uses include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#0000FF&quot;&gt;Cyber Security Alerts &lt;br&gt;
Specials&lt;br&gt;
Job Postings &lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/computer-service.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:09:07 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Governments</title>
<description>FeedForAll helps Governments communicate with the general public about positions on various issues, and keep the community aware of changes in important legislative issues. &lt;b&gt;&lt;i&gt;&lt;br&gt;
&lt;/b&gt;&lt;/i&gt;&lt;br&gt;
RSS uses Include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#00FF00&quot;&gt;Legislative Calendar&lt;br&gt;
Votes&lt;br&gt;
Bulletins&lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/government.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:09:05 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Politicians</title>
<description>FeedForAll helps Politicians communicate with the general public about positions on various issues, and keep the community notified of their schedule. &lt;br&gt;
&lt;br&gt;
Uses Include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#FF0000&quot;&gt;Blogs&lt;br&gt;
Speaking Engagements &lt;br&gt;
Statements&lt;br&gt;
&lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/politics.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:09:03 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Meteorologists</title>
<description>FeedForAll helps Meteorologists communicate with the general public about storm warnings and weather alerts, in specific regions. Using RSS meteorologists are able to quickly disseminate urgent and life threatening weather warnings. &lt;br&gt;
&lt;br&gt;
Uses Include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#0000FF&quot;&gt;Weather Alerts&lt;br&gt;
Plotting Storms&lt;br&gt;
School Cancellations &lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/weather.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:09:01 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Realtors &amp; Real Estate Firms</title>
<description>FeedForAll helps Realtors and Real Estate companies communicate with clients informing them of newly available properties, and open house announcements. RSS helps to reach a targeted audience and spread the word in an inexpensive, professional manner. &lt;font color=&quot;#0000FF&quot;&gt;&lt;br&gt;
&lt;/font&gt;&lt;br&gt;
Feeds can be used for:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#FF0000&quot;&gt;Open House Dates&lt;br&gt;
New Properties For Sale&lt;br&gt;
Mortgage Rates&lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/real-estate.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:08:59 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Banks / Mortgage Companies</title>
<description>FeedForAll helps &lt;b&gt;Banks, Credit Unions and Mortgage companies&lt;/b&gt; communicate with the general public about rate changes in a prompt and professional manner. &lt;br&gt;
&lt;br&gt;
Uses include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#0000FF&quot;&gt;Mortgage Rates&lt;br&gt;
Foreign Exchange Rates &lt;br&gt;
Bank Rates&lt;br&gt;
Specials&lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/banks.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:08:57 -0400</pubDate>
</item>
<item>
<title>RSS Solutions for Law Enforcement</title>
<description>&lt;b&gt;FeedForAll&lt;/b&gt; helps Law Enforcement Professionals communicate with the general public and other agencies in a prompt and efficient manner. Using RSS police are able to quickly disseminate urgent and life threatening information. &lt;br&gt;
&lt;br&gt;
Uses include:&lt;br&gt;
&lt;i&gt;&lt;font color=&quot;#0000FF&quot;&gt;Amber Alerts&lt;br&gt;
Sex Offender Community Notification &lt;br&gt;
Weather Alerts &lt;br&gt;
Scheduling &lt;br&gt;
Security Alerts &lt;br&gt;
Police Report &lt;br&gt;
Meetings&lt;/i&gt;&lt;/font&gt;</description>
<link>http://www.feedforall.com/law-enforcement.htm</link>
<category domain="www.dmoz.com">Computers/Software/Internet/Site Management/Content Management</category>
<comments>http://www.feedforall.com/forum</comments>
<pubDate>Tue, 19 Oct 2004 11:08:56 -0400</pubDate>
</item>
</channel>
</rss>
Loading

0 comments on commit 89cfff3

Please sign in to comment.