View Single Post
Old 03-23-2011, 11:50 AM   #3
Hurda
Junior Member
Hurda began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
Quote:
Originally Posted by Starson17 View Post
It sounds like you are saying that you want an image from the feed page. Where do you want to put that image? On the article page or the page that lists the articles?

A standard Calibre recipe-created ebook puts the images on the article page.
I'm trying to do exactly that, I don't think I'm removing them, yet they are not there (on the article page) - where shoudl tehy be? after first h1,h2 or at the end?

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']
Hurda is offline   Reply With Quote