mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
58 lines
1.9 KiB
Plaintext
58 lines
1.9 KiB
Plaintext
|
|
__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
|