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