mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Nezavisne Novine by Darko Miletic. Fixes #1132143 (New recipe for Nezavisne novine)
This commit is contained in:
parent
626993f6bc
commit
d464e8b70e
BIN
recipes/icons/nezavisne_novine.png
Normal file
BIN
recipes/icons/nezavisne_novine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 454 B |
59
recipes/nezavisne_novine.recipe
Normal file
59
recipes/nezavisne_novine.recipe
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2013, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
www.nezavisne.com
|
||||||
|
'''
|
||||||
|
from calibre import strftime
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class NezavisneNovine(BasicNewsRecipe):
|
||||||
|
title = 'Nezavisne novine'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Nezavisne novine - Najnovije vijesti iz BiH, Srbije, Hrvatske, Crne Gore i svijeta'
|
||||||
|
publisher = 'NIGP "DNN"'
|
||||||
|
category = 'news, politics, Bosnia, Balcans'
|
||||||
|
oldest_article = 2
|
||||||
|
max_articles_per_feed = 200
|
||||||
|
no_stylesheets = True
|
||||||
|
encoding = 'utf8'
|
||||||
|
use_embedded_content = False
|
||||||
|
language = 'sr'
|
||||||
|
remove_empty_feeds = True
|
||||||
|
publication_type = 'newspaper'
|
||||||
|
cover_url = strftime('http://pdf.nezavisne.com/slika/novina/nezavisne_novine.jpg?v=%Y%m%d')
|
||||||
|
masthead_url = 'http://www.nezavisne.com/slika/osnova/nezavisne-novine-logo.gif'
|
||||||
|
extra_css = """
|
||||||
|
body{font-family: Arial,Helvetica,sans-serif }
|
||||||
|
img{margin-bottom: 0.4em; display:block}
|
||||||
|
"""
|
||||||
|
|
||||||
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
}
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'class':'vijest'})]
|
||||||
|
remove_tags_after = dict(name='div', attrs={'id':'wrap'})
|
||||||
|
remove_tags = [
|
||||||
|
dict(name=['meta','link','iframe','object'])
|
||||||
|
,dict(name='div', attrs={'id':'wrap'})
|
||||||
|
]
|
||||||
|
remove_attributes=['lang','xmlns:fb','xmlns:og']
|
||||||
|
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Novosti' , u'http://feeds.feedburner.com/Novosti-NezavisneNovine' )
|
||||||
|
,(u'Posao' , u'http://feeds.feedburner.com/Posao-NezavisneNovine' )
|
||||||
|
,(u'Sport' , u'http://feeds.feedburner.com/Sport-NezavisneNovine' )
|
||||||
|
,(u'Komentar' , u'http://feeds.feedburner.com/Komentari-NezavisneNovine' )
|
||||||
|
,(u'Umjetnost i zabava' , u'http://feeds.feedburner.com/UmjetnostIZabava-NezavisneNovine' )
|
||||||
|
,(u'Život i stil' , u'http://feeds.feedburner.com/ZivotIStil-NezavisneNovine' )
|
||||||
|
,(u'Auto' , u'http://feeds.feedburner.com/Auto-NezavisneNovine' )
|
||||||
|
,(u'Nauka i tehnologija', u'http://feeds.feedburner.com/NaukaITehnologija-NezavisneNovine')
|
||||||
|
]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
return soup
|
@ -341,6 +341,7 @@ pêché'''
|
|||||||
|
|
||||||
german = create(german)
|
german = create(german)
|
||||||
c = _icu.Collator('de')
|
c = _icu.Collator('de')
|
||||||
|
c.numeric = True
|
||||||
gs = list(sorted(german, key=c.sort_key))
|
gs = list(sorted(german, key=c.sort_key))
|
||||||
if gs != create(german_good):
|
if gs != create(german_good):
|
||||||
print 'German sorting failed'
|
print 'German sorting failed'
|
||||||
@ -348,6 +349,7 @@ pêché'''
|
|||||||
print
|
print
|
||||||
french = create(french)
|
french = create(french)
|
||||||
c = _icu.Collator('fr')
|
c = _icu.Collator('fr')
|
||||||
|
c.numeric = True
|
||||||
fs = list(sorted(french, key=c.sort_key))
|
fs = list(sorted(french, key=c.sort_key))
|
||||||
if fs != create(french_good):
|
if fs != create(french_good):
|
||||||
print 'French sorting failed (note that French fails with icu < 4.6)'
|
print 'French sorting failed (note that French fails with icu < 4.6)'
|
||||||
@ -396,6 +398,25 @@ pêché'''
|
|||||||
print 'startswith() failed'
|
print 'startswith() failed'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
print '\nTesting collation_order()'
|
||||||
|
for group in [
|
||||||
|
('Šaa', 'Smith', 'Solženicyn', 'Štepánek'),
|
||||||
|
('calibre', 'Charon', 'Collins'),
|
||||||
|
('01', '1'),
|
||||||
|
('1', '11', '13'),
|
||||||
|
]:
|
||||||
|
last = None
|
||||||
|
for x in group:
|
||||||
|
val = icu_collation_order(sort_collator(), x)
|
||||||
|
if val[1] != 1:
|
||||||
|
prints('collation_order() returned incorrect length for', x)
|
||||||
|
if last is None:
|
||||||
|
last = val
|
||||||
|
else:
|
||||||
|
if val != last:
|
||||||
|
prints('collation_order() returned incorrect value for', x)
|
||||||
|
last = val
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user