New recipe for Jutarnji (thanks to Darko Miletic)

This commit is contained in:
Kovid Goyal 2008-12-04 11:20:13 -08:00
parent b5d167512a
commit b6f9ffbab7

View File

@ -1,45 +1,42 @@
''' #!/usr/bin/env python
Profile to download Jutarnji.hr by Valloric
''' __license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
import re '''
jutarnji.hr
from calibre.web.feeds.news import BasicNewsRecipe '''
class Jutarnji(BasicNewsRecipe): from calibre.web.feeds.news import BasicNewsRecipe
title = 'Jutarnji' class Jutarnji(BasicNewsRecipe):
description = 'News from Croatia' title = u'Jutarnji'
__author__ = 'Valloric' __author__ = u'Darko Miletic'
use_embedded_content = False description = u'Hrvatski portal'
timefmt = ' [%d %b %Y]' oldest_article = 7
max_articles_per_feed = 80 max_articles_per_feed = 100
html_description = True no_stylesheets = True
no_stylesheets = True use_embedded_content = False
encoding = 'cp1250'
preprocess_regexps = [
(re.compile(r'<body.*?<span class="vijestnaslov">', re.IGNORECASE | re.DOTALL), lambda match : '<body><span class="vijestnaslov">'), remove_tags = [dict(name='embed')]
(re.compile(r'</div>.*?</td>', re.IGNORECASE | re.DOTALL), lambda match : '</div></td>'),
(re.compile(r'<a name="addComment.*?</body>', re.IGNORECASE | re.DOTALL), lambda match : '</body>'), feeds = [
(re.compile(r'<br>', re.IGNORECASE | re.DOTALL), lambda match : ''), (u'Naslovnica' , u'http://www.jutarnji.hr/rss' )
] ,(u'Sport' , u'http://www.jutarnji.hr/sport/rss' )
,(u'Jutarnji2' , u'http://www.jutarnji.hr/j2/rss' )
## Getting the print version ,(u'Kultura' , u'http://www.jutarnji.hr/kultura/rss' )
,(u'Spektakli' , u'http://www.jutarnji.hr/spektakli/rss' )
def print_version(self, url): ,(u'Dom i nekretnine', u'http://www.jutarnji.hr/nekretnine/rss')
return 'http://www.jutarnji.hr/ispis_clanka.jl?artid=' + url[len(url)-9:len(url)-3] ,(u'Uhvati ritam' , u'http://www.jutarnji.hr/kalendar/rss' )
]
## Comment out the feeds you don't want retrieved. def print_version(self, url):
## Or add any new new RSS feed URL's here, sorted alphabetically when converted to LRF main = url.partition('.jl')[0]
## If you want one of these at the top, append a space in front of the name. rrest = main.rpartition(',')[-1]
return 'http://www.jutarnji.hr/ispis_clanka.jl?artid=' + rrest
feeds = [
(' Naslovnica', 'http://www.jutarnji.hr/rss'), def preprocess_html(self, soup):
('Sport', 'http://www.jutarnji.hr/sport/rss'), mtag = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
('Novac', 'http://www.jutarnji.hr/novac/rss'), soup.head.insert(0,mtag)
('Kultura i zivot', 'http://www.jutarnji.hr/kultura_i_zivot/rss'), return soup
('Automoto', 'http://www.jutarnji.hr/auto_moto/rss'),
('Hi-Tech', 'http://www.jutarnji.hr/kultura_i_zivot/hi-tech/rss'),
('Dom i nekretnine', 'http://www.jutarnji.hr/nekretnine/rss'),
]