mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #8889 (New recipe for njuz.net website)
This commit is contained in:
parent
87c484e9c0
commit
0379b914e7
BIN
resources/images/news/njuz_net.png
Normal file
BIN
resources/images/news/njuz_net.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 914 B |
61
resources/recipes/njuz_net.recipe
Normal file
61
resources/recipes/njuz_net.recipe
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
njuz.net
|
||||||
|
'''
|
||||||
|
import re
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class NjuzNet(BasicNewsRecipe):
|
||||||
|
title = 'Njuz.net'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Iscasene vesti iz Srbije, regiona i sveta'
|
||||||
|
publisher = 'njuz.net'
|
||||||
|
category = 'news, politics, humor, Serbia'
|
||||||
|
oldest_article = 2
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
encoding = 'utf8'
|
||||||
|
language = 'sr'
|
||||||
|
publication_type = 'newsportal'
|
||||||
|
masthead_url = 'http://www.njuz.net/njuznet.jpg'
|
||||||
|
extra_css = """
|
||||||
|
@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)}
|
||||||
|
body{font-family: serif1, serif}
|
||||||
|
.articledescription{font-family: serif1, serif}
|
||||||
|
.wp-caption-text{font-size: x-small}
|
||||||
|
"""
|
||||||
|
|
||||||
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
}
|
||||||
|
|
||||||
|
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
|
||||||
|
|
||||||
|
keep_only_tags = [
|
||||||
|
dict(attrs={'id':'entryMeta'})
|
||||||
|
,dict(attrs={'class':'post'})
|
||||||
|
]
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name=['embed','link','base','iframe','object','meta','fb:like'])
|
||||||
|
,dict(name='div', attrs={'id':'tagsandcats'})
|
||||||
|
]
|
||||||
|
remove_tags_after= dict(name='div', attrs={'id':'tagsandcats'})
|
||||||
|
remove_attributes= ['lang']
|
||||||
|
feeds = [(u'Clanci', u'http://www.njuz.net/feed/')]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
for alink in soup.findAll('a'):
|
||||||
|
if alink.string is not None:
|
||||||
|
tstr = alink.string
|
||||||
|
alink.replaceWith(tstr)
|
||||||
|
return soup
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user