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 04-06-2011, 02:04 PM   #1
fyoung
Member
fyoung began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Mar 2011
Device: kobo
Local Paper recipe - need help

Ok so I am new to this recipe thing and I am setting up a recipe for my local paper. Now the local paper has several RSS feeds, so my question is how do I set up one recipe to link to all the feeds supplied by the paper? The local paper is the LadysmithChronicle.com
fyoung is offline   Reply With Quote
Old 04-06-2011, 02:25 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 fyoung View Post
Ok so I am new to this recipe thing and I am setting up a recipe for my local paper. Now the local paper has several RSS feeds, so my question is how do I set up one recipe to link to all the feeds supplied by the paper? The local paper is the LadysmithChronicle.com
You can start with a Basic Recipe - it allows multiple feeds. Then, when you decide you want to remove junk, you can switch it to an Advanced Recipe and begin removing tags and improving it.
Starson17 is offline   Reply With Quote
 
Advertisement
Old 04-06-2011, 04:07 PM   #3
fyoung
Member
fyoung began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Mar 2011
Device: kobo
Thanks for that, I will give it a go.
fyoung is offline   Reply With Quote
Old 04-08-2011, 08:23 AM   #4
ironcat
Junior Member
ironcat began at the beginning.
 
ironcat's Avatar
 
Posts: 5
Karma: 10
Join Date: Mar 2011
Location: Budapest, Hungary
Device: Kindle 3 Wi-Fi
You may start with this:
Spoiler:

Code:
import re
from calibre.web.feeds.recipes import BasicNewsRecipe

class LadysmithChronicle(BasicNewsRecipe):
    title                 = 'LadysmithCronicle.com'
    __author__            = u''
    description           = u'LadysmithCronicle.com'
    oldest_article        = 7
    language              = 'en'
    publisher             = 'BlackPress'
    category              = u'news'

    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    encoding              = 'utf8'
    extra_css             = 'body{ font-family: Verdana,Helvetica,Arial,sans-serif }'
    preprocess_regexps    = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')]
    remove_tags_before    = dict(id='mobileStory')
    remove_tags_after     = dict(id='mobileStory')
    remove_tags           = [
                              dict(name='div', attrs={'class':'footer'})
                             ,dict(name='strong', attrs={'style':'color: #003366;'})
                             ,dict(name='a', attrs={'class':'backLink'})
                            ]
    remove_javascript     = True
    remove_empty_feeds    = True

    feeds = [
              (u'News', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/news/index.rss')
             ,(u'Sports', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/sports/index.rss')
             ,(u'Business', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/business/index.rss')
             ,(u'Entertainment', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/entertainment/index.rss')
             ,(u'Lifestyles', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/lifestyles/index.rss')
             ,(u'Community', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/community/index.rss')
             ,(u'Opinion', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/opinion/index.rss')
             ,(u'Letters', u'http://www.bclocalnews.com/vancouver_island_central/ladysmithchronicle/opinion/letters/index.rss')
            ]

    def print_version(self, url):
         return url+'?mobile=true'
ironcat is offline   Reply With Quote
Old 04-11-2011, 08:12 PM   #5
fyoung
Member
fyoung began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Mar 2011
Device: kobo
I will give this a go
Thx
fyoung is offline   Reply With Quote
Old 04-12-2011, 12:23 AM   #6
fyoung
Member
fyoung began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Mar 2011
Device: kobo
So I copied and pasted this receipe and tried it. I got the same results as when I copied the RSS feeds and made a receipe. Both work well but I need to learn how to get rid of some of the useless information following each headline. There is some text following each headline such as Comments ............... and is the exact same following each article.
fyoung is offline   Reply With Quote
Old 04-12-2011, 10:29 AM   #7
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 fyoung View Post
So I copied and pasted this receipe and tried it. I got the same results as when I copied the RSS feeds and made a receipe. Both work well but I need to learn how to get rid of some of the useless information following each headline. There is some text following each headline such as Comments ............... and is the exact same following each article.
Your next step is to learn how to use remove_tags.

See here.
Starson17 is offline   Reply With Quote
Old 04-12-2011, 10:57 AM   #8
ironcat
Junior Member
ironcat began at the beginning.
 
ironcat's Avatar
 
Posts: 5
Karma: 10
Join Date: Mar 2011
Location: Budapest, Hungary
Device: Kindle 3 Wi-Fi
I tried again my version, but that removes the comments. Did you copy the remove_tags and last lines (def print_version ...) of recipe?
ironcat is offline   Reply With Quote
Old 04-13-2011, 11:09 PM   #9
fyoung
Member
fyoung began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Mar 2011
Device: kobo
Ironcat
I copied your receipe again and tried it, it worked perfectly. Pictures and everything.
I must have done something wrong when I did it the first time.
Thanks for your help.
fyoung 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 works when mocked up as Python file, fails when converted to Recipe ode Recipes 7 09-04-2011 05:57 AM
Electronic edition of my local paper kkoburger Calibre 3 07-04-2010 10:42 PM
Quantum Paper claims to revolutionize electronic display/paper industry Alexander Turcic News 12 04-10-2008 12:20 AM
Paper Four: Digital paper that talks to you Alexander Turcic News 10 06-09-2007 11:28 AM
PVI delays flexible e-paper to end-2007 / color e-paper in 2009 Alexander Turcic News 1 06-08-2007 04:52 AM


All times are GMT -4. The time now is 09:20 PM.


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