Thread: RSS and CSS ?
View Single Post
Old 10-28-2009, 10:23 PM   #10
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
Quote:
Originally Posted by kovidgoyal View Post
1) the recipe system doesn't have a css processor, but you can just use extra_css to override any particular css in the stylesheet that you dont like.
woot !!! i think i've got it now. i'll post this in the recipe thread in case anyone else wants to use it or clean it up further. thank you for the assistance !!

Quote:
class AdvancedUserRecipe1256774004(BasicNewsRecipe):
title = u'World Wide Words'
oldest_article = 7
max_articles_per_feed = 100
use_embedded_content=False

feeds = [(u'Magazine', u'http://www.worldwidewords.org/rss/newsletter.xml')]

remove_tags = [dict(name='div', attrs={'class':'navbar1'}),
{'class': ['logo-wide','navhead','navlink1',]},
]


keep_only_tags = [dict(name='div', attrs={'class':'bodyblock'})]

def postprocess_html(self, soup, first):

for tag in soup.findAll(name= 'img', alt=""):
tag.extract()

for item in soup.findAll(name=['width']):
del item['width']

for tag in soup.findAll(name=['table', 'tr', 'td']):
tag.name = 'div'

return soup

extra_css = '''
.image-l{width: 30%}
.image-r{width: 30%}
.nl-itemhead{width: 90%}
.nl-itemhead1{width: 90%}
.nl-menuitem{width: 90%}
.bodyblock{width: 90%;margin-left: 10px;margin-right: 13px;}
@font-face {font-family: "DejaVuSerif";font-weight: normal;font-style: normal;src: url(../fonts/DejaVuSerif.ttf);}
@font-face {font-family: "DejaVuSerif";font-weight: bold;font-style: normal;src: url(../fonts/DejaVuSerif-Bold.ttf);}
@font-face {font-family: "DejaVuSerif";font-weight: normal;font-style: italic;src: url(../fonts/DejaVuSerif-Italic.ttf);}
@font-face {font-family: "DejaVuSerif";font-weight: bold;font-style: italic;src: url(../fonts/DejaVuSerif-BoldItalic.ttf);}
body {font-family: "DejaVuSerif", serif;}
'''
Quote:
2) That shouldn't happen. Look at the log from the recipe download to get an idea of what's happening
here's the log. i'll try to fix it, if you tell me where to look. at this point that's just a tiny detail i can live with.

Spoiler:
Récupérer des News de World Wide Words 5
InputFormatPlugin: Recipe Input running Downloading
Downloading
Downloading
Downloading
FetchingDownloading
http://www.worldwidewords.org/nl/okbl.htm#N2
Fetching http://www.worldwidewords.org/nl/okbl.htm#N3
Fetching http://www.worldwidewords.org/nl/okbl.htm#N1Fetching
http://www.worldwidewords.org/nl/okbl.htm#N5
Fetching http://www.worldwidewords.org/nl/okbl.htm#N4
Processing images...
Fetching http://www.worldwidewords.org/img/returntotop.gif
Processing images...
Fetching http://www.worldwidewords.org/img/returntotop.gif
Processing images...
Fetching http://www.worldwidewords.org/img/returntotop.gif
Processing images...
Fetching http://www.worldwidewords.org/img/returntotop.gif
Processing images...
Fetching http://www.worldwidewords.org/img/returntotop.gif
Fetching http://www.worldwidewords.org/img/pronquery.gif
Fetching http://www.worldwidewords.org/img/pronquery.gif
Fetching http://www.worldwidewords.org/img/pronquery.gif
Fetching http://www.worldwidewords.org/img/pronquery.gif
Fetching http://www.worldwidewords.org/img/pronquery.gif
Fetching http://www.worldwidewords.org/img/hermes.jpg
Fetching http://www.worldwidewords.org/img/hermes.jpg
Fetching http://www.worldwidewords.org/img/hermes.jpg
Fetching http://www.worldwidewords.org/img/hermes.jpg
Fetching http://www.worldwidewords.org/img/hermes.jpg
Fetching http://www.worldwidewords.org/img/re/histhesoed.jpg
Fetching http://www.worldwidewords.org/img/re/histhesoed.jpg
Fetching http://www.worldwidewords.org/img/re/histhesoed.jpg
Fetching http://www.worldwidewords.org/img/re/histhesoed.jpg
Fetching http://www.worldwidewords.org/img/re/histhesoed.jpg
Fetching http://www.worldwidewords.org/img/amazon-uk2.gif
Fetching http://www.worldwidewords.org/img/amazon-uk2.gif
Fetching http://www.worldwidewords.org/img/amazon-uk2.gif
Fetching http://www.worldwidewords.org/img/amazon-uk2.gif
Fetching http://www.worldwidewords.org/img/amazon-uk2.gif
Fetching http://www.worldwidewords.org/img/amazon-us2.gif
Fetching http://www.worldwidewords.org/img/amazon-us2.gif
Fetching http://www.worldwidewords.org/img/amazon-us2.gif
Fetching http://www.worldwidewords.org/img/amazon-us2.gif
Fetching http://www.worldwidewords.org/img/amazon-us2.gif
Fetching http://www.worldwidewords.org/img/amazon-ca2.gif
Fetching http://www.worldwidewords.org/img/amazon-ca2.gif
Fetching http://www.worldwidewords.org/img/amazon-ca2.gif
Fetching http://www.worldwidewords.org/img/amazon-ca2.gif
Fetching http://www.worldwidewords.org/img/amazon-ca2.gif
Fetching http://www.worldwidewords.org/img/amazon-de2.gif
Fetching http://www.worldwidewords.org/img/amazon-de2.gif
Fetching http://www.worldwidewords.org/img/amazon-de2.gif
Fetching http://www.worldwidewords.org/img/amazon-de2.gif
Fetching http://www.worldwidewords.org/img/amazon-de2.gif
Fetching http://www.worldwidewords.org/styles/wordsmain.css
Fetching http://www.worldwidewords.org/styles/wordsmain.css
Fetching http://www.worldwidewords.org/styles/wordsmain.css
Fetching http://www.worldwidewords.org/styles/wordsmain.css
Fetching http://www.worldwidewords.org/styles/wordsmain.css
Fetching http://www.worldwidewords.org/styles...newsletter.css
Fetching http://www.worldwidewords.org/styles...newsletter.css
Fetching http://www.worldwidewords.org/styles...newsletter.css
Fetching http://www.worldwidewords.org/styles...newsletter.css
Fetching http://www.worldwidewords.org/styles...newsletter.css
Recursion limit reached. Skipping links in http://www.worldwidewords.org/nl/okbl.htm#N2
http://www.worldwidewords.org/nl/okbl.htm#N2 saved to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ ofnany_plumber\feed_0\article_1\okbl.xhtml
Downloading
Fetching http://www.worldwidewords.org/nl/okbl.htm#N6
Downloaded article: 662-2: Turns of Phrase: Epigenome from http://www.worldwidewords.org/nl/okbl.htm#N2
Recursion limit reached. Skipping links in http://www.worldwidewords.org/nl/okbl.htm#N3
http://www.worldwidewords.org/nl/okbl.htm#N3 saved to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ ofnany_plumber\feed_0\article_2\okbl.xhtml
Downloading
Fetching http://www.worldwidewords.org/nl/okbl.htm#N7
Downloaded article: 662-3: Weird Words: Talaria from http://www.worldwidewords.org/nl/okbl.htm#N3
Recursion limit reached. Skipping links in http://www.worldwidewords.org/nl/okbl.htm#N5
http://www.worldwidewords.org/nl/okbl.htm#N5 saved to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ ofnany_plumber\feed_0\article_4\okbl.xhtml
Downloaded article: 662-5: Reviews: Historical Thesaurus of the Oxford English Dictionary from http://www.worldwidewords.org/nl/okbl.htm#N5
Recursion limit reached. Skipping links in http://www.worldwidewords.org/nl/okbl.htm#N1
http://www.worldwidewords.org/nl/okbl.htm#N1 saved to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ ofnany_plumber\feed_0\article_0\okbl.xhtml
Downloaded article: 662-1: Feedback, notes and comments from http://www.worldwidewords.org/nl/okbl.htm#N1
Recursion limit reached. Skipping links in http://www.worldwidewords.org/nl/okbl.htm#N4
http://www.worldwidewords.org/nl/okbl.htm#N4 saved to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ ofnany_plumber\feed_0\article_3\okbl.xhtml
Downloaded article: 662-4: What I've learned this week from http://www.worldwidewords.org/nl/okbl.htm#N4
Processing images...
Recursion limit reached. Skipping links in http://www.worldwidewords.org/nl/okbl.htm#N6
http://www.worldwidewords.org/nl/okbl.htm#N6 saved to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ ofnany_plumber\feed_0\article_5\okbl.xhtml
Downloaded article: 662-6: Sic! from http://www.worldwidewords.org/nl/okbl.htm#N6
Processing images...
Recursion limit reached. Skipping links in http://www.worldwidewords.org/nl/okbl.htm#N7
http://www.worldwidewords.org/nl/okbl.htm#N7 saved to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ ofnany_plumber\feed_0\article_6\okbl.xhtml
Downloaded article: 662-7: Copyright and contact details from http://www.worldwidewords.org/nl/okbl.htm#N7
Parsing all content...
Parsing feed_0/article_0/stylesheets/style0.css ...
Parsing feed_0/article_2/stylesheets/style0.css ...
Parsing feed_0/article_3/index.html ...
Parsing feed_0/article_3/stylesheets/style0.css ...
Parsing feed_0/index.html ...
Parsing feed_0/article_4/index.html ...
Parsing feed_0/article_1/stylesheets/style1.css ...
Parsing feed_0/article_4/stylesheets/style0.css ...
Parsing feed_0/article_5/index.html ...
Parsing feed_0/article_6/index.html ...
Parsing index.html ...
Parsing feed_0/article_2/stylesheets/style1.css ...
Parsing feed_0/article_1/stylesheets/style0.css ...
Parsing feed_0/article_1/index.html ...
Parsing feed_0/article_0/stylesheets/style1.css ...
Parsing feed_0/article_3/stylesheets/style1.css ...
Parsing feed_0/article_0/index.html ...
Parsing feed_0/article_2/index.html ...
Parsing feed_0/article_4/stylesheets/style1.css ...
Referenced file 'feed_0/pronguide.htm' not found
Referenced file 'feed_0/copyright.htm' not found
Referenced file 'feed_0/feedback.htm' not found
Referenced file 'feed_1/index.html' not found
Reading TOC from NCX...
Merging user specified metadata...
Detecting structure...
Flattening CSS and remapping font sizes...
Source base font size is 10.80000pt
Cleaning up manifest...
Trimming unused files from manifest...
Parsing stylesheet.css ...
Creating EPUB Output...
Looking for large trees in feed_0/article_3/index.html...
No large trees found
Looking for large trees in feed_0/index.html...
No large trees found
Looking for large trees in feed_0/article_4/index.html...
No large trees found
Looking for large trees in feed_0/article_5/index.html...
No large trees found
Looking for large trees in feed_0/article_6/index.html...
No large trees found
Looking for large trees in index.html...
No large trees found
Looking for large trees in feed_0/article_1/index.html...
No large trees found
Looking for large trees in feed_0/article_0/index.html...
No large trees found
Looking for large trees in feed_0/article_2/index.html...
No large trees found
EPUB output written to c:\docume~1\letigr~1\locals~1\temp\calibre_0.6.12_ md_jjs_recipe_out.epub
Attached Files
File Type: epub World Wide Words [jeu., 29 oct. 2009] - calibre.epub (253.2 KB, 161 views)

Last edited by zelda_pinwheel; 10-28-2009 at 10:25 PM.
zelda_pinwheel is offline   Reply With Quote