Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-10-2011, 04:07 PM   #1
bosplans
Member
bosplans began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Mar 2011
Device: kindle 3
New recipe voxeu.org - image problem

I am preparing a new recipe for voxeu.org, an Europeany policy porta.
The recipe so far work properly apart the images in articles fetched are not displayed in the output. Looks like the recipe get the wrong link to the original image (it is a relative link).
Any workaround to fix the problem?

Here the recipe source:

Code:
class Vox(BasicNewsRecipe):
    __author__        = 'Voxeu.org'
    description   = 'Policy portal set up by the Centre for Economic Policy Research'

    cover_url      = 'http://farm7.static.flickr.com/6122/6030018218_2a48a07230_z.jpg'
    title          = u'Vox'
    category       = 'Policy, politics, culture, economy, financial, Italian'

    language       = 'en'
    timefmt        = '[%a, %d %b, %Y]'

    oldest_article = 7
    max_articles_per_feed = 100
    use_embedded_content  = False
    recursion             = 10
    extra_css      = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt  }'

         
    remove_tags = [
                            dict(name='fieldset', attrs={'class':['fieldgroup group-authors','fieldgroup group-editors-choice']}),
                            dict(name='div', attrs={'class':['print-taxonomy','print-footer','print-source_url','print-links']}),
                           ]

    feeds = [
                  (u'Notizie', u'http://www.voxeu.org/rss.php?q=recent'),
                ]

    def print_version(self, url):
          return url.replace('node', 'print')
Thanks!
bosplans is offline   Reply With Quote
Old 08-10-2011, 04:15 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use preprocess_html to set the correct url in the img tags.
kovidgoyal is online now   Reply With Quote
Advert
Old 08-10-2011, 04:29 PM   #3
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 bosplans View Post
I am preparing a new recipe for voxeu.org, an Europeany policy porta.
The recipe so far work properly apart the images in articles fetched are not displayed in the output. Looks like the recipe get the wrong link to the original image (it is a relative link).
Any workaround to fix the problem?

Here the recipe source:

Spoiler:
Code:
class Vox(BasicNewsRecipe):
    __author__        = 'Voxeu.org'
    description   = 'Policy portal set up by the Centre for Economic Policy Research'

    cover_url      = 'http://farm7.static.flickr.com/6122/6030018218_2a48a07230_z.jpg'
    title          = u'Vox'
    category       = 'Policy, politics, culture, economy, financial, Italian'

    language       = 'en'
    timefmt        = '[%a, %d %b, %Y]'

    oldest_article = 7
    max_articles_per_feed = 100
    use_embedded_content  = False
    recursion             = 10
    extra_css      = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt  }'

         
    remove_tags = [
                            dict(name='fieldset', attrs={'class':['fieldgroup group-authors','fieldgroup group-editors-choice']}),
                            dict(name='div', attrs={'class':['print-taxonomy','print-footer','print-source_url','print-links']}),
                           ]

    feeds = [
                  (u'Notizie', u'http://www.voxeu.org/rss.php?q=recent'),
                ]

    def print_version(self, url):
          return url.replace('node', 'print')

Thanks!
If it's a relative link, then just replace the relative link with a full link by modifying the link. There are lots of recipes that do that. Try looking at the adventuregamers recipe. It does it like this when dealing with a relative link:

INDEX = u'http://www.adventuregamers.com'
nexturl = self.INDEX + pager.a['href']
Starson17 is offline   Reply With Quote
Old 08-10-2011, 06:35 PM   #4
bosplans
Member
bosplans began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Mar 2011
Device: kindle 3
Thank you for the tips.
I figure it out!
bosplans is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
skepticblog.org - Recipe not working BuzzKill Recipes 4 07-01-2016 12:20 PM
help building recipe to rebelion.org de.now Recipes 3 05-18-2012 04:49 AM
Recipe for talkorigins.org? AGB Recipes 0 05-23-2011 12:38 PM
Help with Recipe - Image Sizes Tegan Recipes 10 01-14-2011 03:52 PM
Recipe Suggestion: OnSuper8.Org KindleKid Calibre 0 07-28-2009 12:31 PM


All times are GMT -4. The time now is 05:45 AM.


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