User:Renee Oldemonnikhof/Technicalcourse2

From XPUB & Lens-Based wiki

Technical course Trimester 2

First assignment

#Looking inside the RSS Feed
import feedparser
# Calling the information from the website and giving it the name "newwork"
newwork = feedparser.parse("http://feeds.feedburner.com/newwork")
import pprint
#pprint.pprint(newwork)
#print(newwork.entries[4]["title"])
print """
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>feedbook</title>
    <link type="text/css" rel="stylesheet" media="all" href="stylesheet.css" />
  </head>
  <body>"""
for e in newwork.entries:
    print"<h1>"
    print e["title"].replace("&", "&amp;").encode("utf-8")
    print"</h1>"
    print"<p>"
    print e["summary"].replace("&", "&amp;").encode("utf-8")
    print"</p>"
    print
print"""
  </body>
</html>"""
#(in the terminal to save it as an html) python feed.py > output.html
Makebook.sh

python feed.py > feedbook/OEBPS/content.html

cd feedbook

zip -0Xq feedbook.epub mimetype

zip -Xr9Dq feedbook.epub *

lucidor feedbook.epub