View Single Post
Old 04-22-2019, 05:19 PM   #1
Ruben00
Junior Member
Ruben00 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Apr 2019
Device: Kindle 2016
Recipe for "Corriere Della Sera"

Quote:
First published on 5 March 1876, Corriere della Sera is one of Italy's oldest newspapers and is Italy's most read newspaper.
The existent recipe no longer works, so I tried to make a new one.
I'm new to Calibre, so please help me improving this recipe

Code:
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
from calibre.web.feeds.news import BasicNewsRecipe

__author__ = 'Ruben Scopacasa'
__license__ = 'GPL v3'
__copyright__ = '2019, Ruben Scopacasa <ruben.scopacasa at gmail.com>'
__version__ = 'v1.00'
__date__ = '22, April 2019'

class CorriereDellaSeraRecipe(BasicNewsRecipe):
    title = u'Il Corriere della sera'
    publisher = 'RCS Digital'
    category = 'News, politics, culture, economy, general interest'
    
    language = 'it'
    timefmt = '[%a, %d %b, %Y]'
    
    oldest_article = 3
    max_articles_per_feed = 100
    simultaneous_downloads = 5
    
    no_stylesheets = True
    remove_tags_before = dict(name='h1')
    remove_tags = [dict(id='gallery')]
    ignore_duplicate_articles = {'title', 'url'}

    feeds = [
        ('Homepage', 'http://xml2.corriereobjects.it/rss/homepage.xml'),
        ('Editoriali', 'http://xml2.corriereobjects.it/rss/editoriali.xml'),
        ('Cronache', 'http://xml2.corriereobjects.it/rss/cronache.xml'),
        ('Politica', 'http://xml2.corriereobjects.it/rss/politica.xml'),
        ('Esteri', 'http://xml2.corriereobjects.it/rss/esteri.xml'),
        ('Economia', 'http://xml2.corriereobjects.it/rss/economia.xml'),
        ('Cultura', 'http://xml2.corriereobjects.it/rss/cultura.xml'),
    ]
        
    def print_version(self, url):
        return url.replace('.shtml', '_print.html')
    
    def get_cover_url(self): 
        return 'http://www.corriere.it/rss/images/logo_small.gif'
Ruben00 is offline   Reply With Quote