User:Darija Medic/technicalcourse/epub

From XPUB & Lens-Based wiki

Epub consists of one feed for the titles, and a second for the chapters.

import feedparser
import pprint
import sys

pull = feedparser.parse("http://xkcd.com/rss.xml")
pull1 = feedparser.parse("http://rss.allrecipes.com/daily.aspx?hubID=80")
print """
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Feeder</title>
    <link type="text/css" rel="stylesheet" media="all" href="stylesheet.css" />
  </head>
  <body>"""
for i in pull.entries:
    print "<h1>"
    print i["title"].replace("&", "&amp;").encode("utf-8")
    print"</h1>"
    for e in pull1.entries:
        print"<p>"
        print e["summary"].replace("&", "&amp;").encode("utf-8")
        print "</p>"

print  """
</body>
</html>"""
sys.exit()


Attachments