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 11-05-2012, 07:54 PM   #1
Frescard
Enthusiast
Frescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with othersFrescard plays well with others
 
Posts: 29
Karma: 2910
Join Date: Aug 2012
Location: Montreal, Canada
Device: Sony PRS-T1
London Review of Books - fixed cover URL

The current recipe doesn't seem to download the cover page for the London Review of Books anymore.

Changing the URL to the code below should get you the cover back:

Code:
__license__   = 'GPL v3'
__copyright__ = '2008-2010, Darko Miletic <darko.miletic at gmail.com>'
'''
lrb.co.uk
'''

from calibre.web.feeds.news import BasicNewsRecipe

class LondonReviewOfBooks(BasicNewsRecipe):
    title                 = 'London Review of Books (free)'
    __author__            = 'Darko Miletic'
    description           = 'Literary review publishing essay-length book reviews and topical articles on politics, literature, history, philosophy, science and the arts by leading writers and thinkers'
    category              = 'News'
    publisher             = 'LRB ltd.'
    oldest_article        = 15
    max_articles_per_feed = 100
    language              = 'en_GB'
    no_stylesheets        = True
    use_embedded_content  = False
    encoding              = 'utf-8'
    publication_type      = 'magazine'
    masthead_url          = 'http://www.lrb.co.uk/assets/images/lrb_logo_big.gif'
    extra_css             = ' body{font-family: Georgia,Palatino,"Palatino Linotype",serif} '

    conversion_options = {
                             'comments'  : description
                            ,'tags'      : category
                            ,'language'  : language
                            ,'publisher' : publisher
                         }

    keep_only_tags = [dict(attrs={'class':['article-body indent','letters','article-list']})]
    remove_attributes = ['width','height']

    feeds = [(u'London Review of Books', u'http://www.lrb.co.uk/lrbrss.xml')]

    def get_cover_url(self):
        cover_url = None
        soup = self.index_to_soup('http://www.lrb.co.uk/')
        cover_item = soup.find('p',attrs={'class':'cover'})
        if cover_item:
           #old: 
           #cover_url = 'http://www.lrb.co.uk' + cover_item.a.img['src']
           #new:
           cover_url = cover_item.a.img['src']
        return cover_url
Frescard 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
London Review of Books recipe updated rainrdx Recipes 1 12-25-2012 06:11 PM
recipe problem with space in cover url forceps Development 4 08-27-2012 04:32 PM
Lost trying to get url for time.com cover Olger Recipes 3 02-14-2012 09:04 AM
Los Tiempos, Bolivia cover URL pietvo Recipes 1 10-18-2011 02:20 PM
London Review of Books Blog JFS-NMF Recipes 0 01-12-2011 02:20 PM


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


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