03-23-2011, 05:15 AM | #1 |
Junior Member
Posts: 6
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
|
Adding image from RSS
I'm trying to create recipe for video games news server http://games.tiscali.cz/
fro the feed http://games.tiscali.cz/rss2.xml There each article has an image: <item> <title>a</title> <guid isPermaLink="true">http://games.tiscali.cz/b</guid> <link>http://games.tiscali.cz/obrazky/b</link> <description><![CDATA[D]]></description> <category><![CDATA[Obrázky]]></category> <author><![CDATA[games@tiscalimedia.cz (levis)]]></author> <pubDate>Tue, 22 Mar 2011 19:53:08 +0000</pubDate> <enclosure url="http://games.cz.imag3box.com/uploads/1-1-game14059-img198044_670x377.jpg" type="image/jpeg"></enclosure> I woudl like to add the image in the enclosure after the first <p> element in the body of an article - what do i need to do. I'm Java programmer, si I'm not skilled with beatiful soap and I can't event find method to override (where I have acces both to current article body and to this rss definition). Thanks in davance |
03-23-2011, 09:40 AM | #2 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
A standard Calibre recipe-created ebook puts the images on the article page. Usually all the images you want are already on that page (on the site) and you just need to make sure you don't remove them with the recipe. If you need to grab them from the RSS feed page, or some other page, that can be done, too. Last edited by Starson17; 03-23-2011 at 09:44 AM. |
|
Advert | |
|
03-23-2011, 11:50 AM | #3 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
|
Quote:
This si my code Code:
import re from calibre.web.feeds.recipes import BasicNewsRecipe class GamesTiscali(BasicNewsRecipe): __author__ = 'hurda@keyelements.org' title = u'Games.tiscali.cz' oldest_article = 7 max_articles_per_feed = 2 remove_empty_feeds = True timefmt = ' [%a - %d.%m.%Y]' description = 'Games.tiscali.cz - The Video Game portal eBook edition' no_stylesheets = True #delay = 1 use_embedded_content = False encoding = 'utf8' publisher = 'Games.tiscali.cz' category = 'Video games' language = 'cs_CZ' publication_type = 'magazine' masthead_url = 'http://games.tiscali.cz/design/logo.gif' cover_url = 'http://games.tiscali.cz/design/logo.gif' extra_css = """ body{ color: black } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2 {text-align: center; text-transform: uppercase} """ feeds = [ (u'Vše', u'http://games.tiscali.cz/rss2.xml'), (u'Recenze', u'http://games.tiscali.cz/recenze/rss2.xml'), (u'Preview', u'http://games.tiscali.cz/preview/rss2.xml'), (u'Dojmy z hraní', u'http://games.tiscali.cz/prvni-dojmy/rss2.xml'), (u'Téma', u'http://games.tiscali.cz/tema/rss2.xml'), (u'Hardware', u'http://games.tiscali.cz/hardware/rss2.xml'), (u'Návod', u'http://games.tiscali.cz/navod/rss2.xml'), (u'Rozhovor', u'http://games.tiscali.cz/rozhovor/rss2.xml'), (u'Oznámení', u'http://games.tiscali.cz/oznameni/rss2.xml'), (u'Retro', u'http://games.tiscali.cz/retro/rss2.xml') ] keep_only_tags = [ dict(name='div', attrs={'class':['content box']}) ] remove_tags = [ dict(name='span', attrs={'class':['article-platform']}), #dict(name='div', attrs={'id':['perex']}), dict(name='object', attrs={'id':['player']}), dict(name='link'), dict(name='meta'), dict(name='div', attrs={'id':['addsense']}), dict(name='ul', attrs={'class':['articles-thumbs box']}), dict(name='ul', attrs={'class':['tabs box']}), dict(name='div', attrs={'class':['box-02 box']}), dict(name='p', attrs={'class':['articles-bottom']}) ] remove_attributes = ['style'] |
|
03-23-2011, 02:01 PM | #4 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
Tags |
recipe images |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding date (and maybe other info) to custom cover image | chewi | Recipes | 7 | 03-16-2011 04:21 AM |
Adding cover image | miwie | Library Management | 9 | 03-04-2011 10:39 AM |
Adding cover image to PDF? | silvijakk | Bookeen | 2 | 04-02-2009 03:33 PM |
Adding a cover image to mobipocket files | rheostaticsfan | Kindle Formats | 4 | 05-25-2008 03:40 PM |
Adding My Own RSS Feeds Safely | JeffASonyReader | Sony Reader Dev Corner | 9 | 01-16-2008 07:05 PM |