User:Renee Oldemonnikhof/Technicalcourse2: Difference between revisions
Line 41: | Line 41: | ||
lucidor feedbook.epub | lucidor feedbook.epub | ||
</source> | </source> | ||
'''Visual representation of the epub''' |
Revision as of 13:44, 4 October 2010
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("&", "&").encode("utf-8")
print"</h1>"
print"<p>"
print e["summary"].replace("&", "&").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
Visual representation of the epub