Skip to content

Instantly share code, notes, and snippets.

@morgotth
Created February 28, 2015 11:25
Show Gist options
  • Save morgotth/1eba91e803828399e1df to your computer and use it in GitHub Desktop.
Save morgotth/1eba91e803828399e1df to your computer and use it in GitHub Desktop.
Generate NHK Japanese Lessons RSS feed. See http://www3.nhk.or.jp/lesson/english/index.html
content = u""
ep = 44
while ep > 0:
content += u"""
<item>
<enclosure url="http://www.nhk.or.jp/lesson/audio/english/Lesson{i}.mp3" length="4802040" type="audio/mpeg"></enclosure>
<title>English : lesson{i}</title>
<itunes:author>NHK WORLD RADIO JAPAN</itunes:author>
<itunes:duration>10:00</itunes:duration>
<itunes:category text="Education">
<itunes:category text="Language Courses" />
</itunes:category>
<pubDate>Tue, 10 Feb 2015 10:{ep}:00 +0900</pubDate>
</item>
""".format(i=ep, ep=unicode(ep).rjust(2))
ep -= 1
print """<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version="2.0">
<channel>
<copyright>NHK (Japan Broadcasting Corporation)</copyright>
<description>For people who want to learn Japanese, NHK WORLD broadcasts a total of 50 lessons, with text and audio downloads for free, updated every week. For more information, please go to www.nhk.or.jp/lesson/english/.</description>
<itunes:subtitle>For people who want to learn Japanese, NHK WORLD broadcasts a total of 50 lessons, with text and audio downloads for free, updated every week. For more information, please go to www.nhk.or.jp/lesson/english/.</itunes:subtitle>
<itunes:author>NHK WORLD RADIO JAPAN</itunes:author>
<itunes:image href="http://www.nhk.or.jp/lesson/common/images/podcast/english.jpg"></itunes:image>
<language>en</language>
<link>http://www.nhk.or.jp/lesson/english/</link>
<lastBuildDate>Tue, 10 Feb 2015 11:00:08 +0900</lastBuildDate>
<title>Japanese Lessons in English - NHK WORLD RADIO JAPAN</title>
<itunes:category text="Education">
<itunes:category text="Language Courses" />
</itunes:category>
<item>
<enclosure url="http://www.nhk.or.jp/lesson/audio/english/Lesson45.mp3" length="4802040" type="audio/mpeg"></enclosure>
<title>English : lesson45</title>
<itunes:author>NHK WORLD RADIO JAPAN</itunes:author>
<itunes:duration>10:00</itunes:duration>
<itunes:category text="Education">
<itunes:category text="Language Courses" />
</itunes:category>
<pubDate>Tue, 10 Feb 2015 11:00:00 +0900</pubDate>
</item>
"""
print content
print """ </channel>
</rss>"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment