10-28-2009, 05:35 PM | #1 |
zeldinha zippy zeldissima
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?
|
RSS and CSS ?
last night i was playing around with the rss feed from World Wide Words. my first version of the recipe had the same feed duplicated accidentally, but when i tried to modify it i accidentally deleted it instead. the trouble is, although i've managed to add the feed again, all my later attempts display very crudely, whereas the first version was nicely formatted (and i have no idea why). anybody have any idea at all how to get the feed to include the css ?
the website is here : http://www.worldwidewords.org/index.htm and i'm attaching examples of the recipes to show the difference. any help would be appreciated. now that i've seen the nice-looking one, i'm having a really hard time settling for the no-css version. |
10-28-2009, 06:38 PM | #2 |
creator of calibre
Posts: 44,351
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Make sure you dont have no_stylesheets set in your recipe (edit it in advanced mode)
|
Advert | |
|
10-28-2009, 06:49 PM | #3 |
zeldinha zippy zeldissima
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?
|
it doesn't look like i do. here's the code of the recipe that doesn't work :
Code:
class AdvancedUserRecipe1256770048(BasicNewsRecipe): title = u'World Wide Words2' oldest_article = 7 max_articles_per_feed = 100 feeds = [(u'World Wide Words Magazine', u'http://www.worldwidewords.org/rss/newsletter.xml')] |
10-28-2009, 06:52 PM | #4 |
creator of calibre
Posts: 44,351
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
try adding
use_embedded_content=False |
10-28-2009, 07:00 PM | #5 |
zeldinha zippy zeldissima
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?
|
getting closer ! the css is back, but now i also have a bunch of extraneous stuff like the webside header and side navigation, which i don't need, and which gets in the way of the text i want to read.
edit : oops, forgot to add file. edit 2 : here's the recipe now : Code:
class AdvancedUserRecipe1256770396(BasicNewsRecipe): title = u'World Wide Words4' oldest_article = 15 max_articles_per_feed = 100 use_embedded_content=False feeds = [(u'Magazine1', u'http://www.worldwidewords.org/rss/newsletter.xml')] Last edited by zelda_pinwheel; 10-28-2009 at 07:04 PM. |
Advert | |
|
10-28-2009, 07:47 PM | #6 |
creator of calibre
Posts: 44,351
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I'm afraid you have to write code to remove the extraneous junk. Instructions are in the User Manual.
|
10-28-2009, 07:49 PM | #7 |
zeldinha zippy zeldissima
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?
|
okay, i'll take a look then, thanks. it's weird that the first time it came out perfect and i didn't do anything differently. a bit frustrating too since i can't seem to get it to do that again... thanks for the help though. if i manage to get it working i'll post the code in the recipes thread in case anyone else is interested.
|
10-28-2009, 09:16 PM | #8 |
zeldinha zippy zeldissima
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?
|
okay, my recipe is getting pretty close to done i think. i've removed the stuff i don't want and i still have the css formatting. i just have 2 questions.
1. in the css, the main body content div has a width of 520px. is there a way to get rid of just the width rules from the css ? (there are a few others but that one is the most problematic.) i saw in your sample recipe that you can selectively remove certain html tags with postprocessing, but this doesn't seem to work for the css code (i tried). i know i *could* remove the style sheets and then add back all the css without the width, but that seems like a rather clumsy solution. 2. i set the recipe to grab 7 days worth of articles. however, it seems to have grabbed the most recent article 7 times instead, and no previous ones. can i fix that somehow ? for the moment the recipe looks like this (i copied the "soup" bits directly out of the sample recipe, i only modified the one in the middle to try to get rid of the "width" styles. i am perfectly happy to also turn all tables into divs if there are any left over) : Code:
class AdvancedUserRecipe1256774004(BasicNewsRecipe): title = u'World Wide Words 5' 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 |
10-28-2009, 09:29 PM | #9 |
creator of calibre
Posts: 44,351
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
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.
2) That shouldn't happen. Look at the log from the recipe download to get an idea of what's happening |
10-28-2009, 10:23 PM | #10 | |||
zeldinha zippy zeldissima
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:
Quote:
Quote:
Spoiler:
Last edited by zelda_pinwheel; 10-28-2009 at 10:25 PM. |
|||
10-28-2009, 11:15 PM | #11 |
creator of calibre
Posts: 44,351
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
the reason is that the links in the RSS feed just point to the same html page but with different anchors. calibre is just fetching that same page 7 times.
Change max_articles_per_feed to 1 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Classic G:RSS: Optimized Google Reader (RSS) for the Nook [BETA Testers needed] | Fmstrat | Barnes & Noble NOOK | 24 | 12-28-2010 12:22 PM |
G:RSS: Optimized Google Reader (RSS) for the Kindle 3 (and Nook) | Fmstrat | Amazon Kindle | 47 | 12-13-2010 12:20 PM |
Is there a good way to convert partial rss to full rss feeds. | Zorz | Other formats | 5 | 05-29-2010 12:17 PM |
help with css | bobcdy | ePub | 2 | 02-13-2010 11:59 AM |
Help with CSS, anyone? | rogue_ronin | Workshop | 36 | 08-14-2009 09:28 PM |