Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 08-03-2011, 11:37 AM   #1
rjchew
Junior Member
rjchew began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Aug 2011
Device: Kindle 3
Modifying different feeds in one recipe

Hello, I've just bought a Kindle 3, and am really enjoying using it with calibre to read news and things. I have been trying to create a news source that combines the various blogs I like to read, and email it to my Kindle. I have managed to do this with the following recipe:
Spoiler:
class AdvancedUserRecipe1312376781(BasicNewsRecipe):
title = u'Blogs'
oldest_article = 1
max_articles_per_feed = 200

feeds = [
(u"Guy Fawkes' blog", u'http://feeds2.feedburner.com/guidofawkes'),
(u'Comment is Free', u'http://www.guardian.co.uk/commentisfree/all/rss'),
(u'Political Betting', u'http://politicalbetting.com/index.php/feed/')
]



However, I want to add some more feeds to this recipe, but they need modification to be readable. For example, the Spectator blog works this code:
Spoiler:
class AdvancedUserRecipe1312371137(BasicNewsRecipe):
title = u'Spectator Coffee House'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
extra_css = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt }'
keep_only_tags = [
dict(name='div', attrs={'class':'text'})]

feeds = [(u'Coffee House', u'http://www.spectator.co.uk/coffeehouse/index.txml')]


Is there anyway I can modify different feeds within the same recipe? So I can make the 'keep_only_tags' for the Spectator blog not affect the other feeds?


I hope this makes sense! I'd be really grateful for any help anyone could offer,
Cheers
rjchew is offline   Reply With Quote
Advert
Old 08-03-2011, 02:27 PM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by rjchew View Post
Is there anyway I can modify different feeds within the same recipe? So I can make the 'keep_only_tags' for the Spectator blog not affect the other feeds?
It's my understanding that 'keep_only_tags' is applied at a very early processing stage, so you can't make them apply to only one feed. However, you can process the feeds separately with Beautiful Soup and use extract() to keep the tags of interest. Another option would be to remove the tags not of interest. If you define the tags to be removed carefully, you may be able to leave the tags you want in multiple feeds.
Starson17 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recipe for Reading Blog Feeds possible ? markwaters Recipes 6 06-22-2011 01:55 PM
One Recipe, Multiple Feeds, Different Printer-Friendly Subs DTM Recipes 9 02-11-2011 02:04 PM
Modifying column display ccayer Calibre 11 05-11-2010 07:18 AM
Help modifying LRFTools Demented LRF 0 08-30-2009 03:03 PM
Modifying Headsets iggypop Lounge 0 03-05-2007 06:31 PM


All times are GMT -4. The time now is 06:32 PM.


MobileRead.com is a privately owned, operated and funded community.