Quantcast
Channel: MobileRead Forums - Calibre
Viewing all articles
Browse latest Browse all 31491

London Review of Books - fixed cover URL

$
0
0
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


Viewing all articles
Browse latest Browse all 31491

Trending Articles