mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2283 (Updated recipe Vreme)
This commit is contained in:
parent
0820e5d90a
commit
54b5a25fa8
@ -11,20 +11,23 @@ from calibre import strftime
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class Vreme(BasicNewsRecipe):
|
class Vreme(BasicNewsRecipe):
|
||||||
title = 'Vreme'
|
title = 'Vreme'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'Politicki Nedeljnik Srbije'
|
description = 'Politicki Nedeljnik Srbije'
|
||||||
publisher = 'Vreme d.o.o.'
|
publisher = 'NP Vreme d.o.o.'
|
||||||
category = 'news, politics, Serbia'
|
category = 'news, politics, Serbia'
|
||||||
no_stylesheets = True
|
delay = 1
|
||||||
remove_javascript = True
|
no_stylesheets = True
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
INDEX = 'http://www.vreme.com'
|
INDEX = 'http://www.vreme.com'
|
||||||
LOGIN = 'http://www.vreme.com/account/index.php'
|
LOGIN = 'http://www.vreme.com/account/login.php?url=%2F'
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
language = _('Serbian')
|
encoding = 'utf-8'
|
||||||
extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{text-align: justify; font-family: serif1, serif} .article_description{font-family: serif1, serif}'
|
language = _('Serbian')
|
||||||
|
lang = 'sr-Latn-RS'
|
||||||
|
direction = 'ltr'
|
||||||
|
extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{text-align: justify; font-family: serif1, serif} .article_description{font-family: serif1, serif}'
|
||||||
|
|
||||||
html2lrf_options = [
|
html2lrf_options = [
|
||||||
'--comment' , description
|
'--comment' , description
|
||||||
@ -52,20 +55,11 @@ class Vreme(BasicNewsRecipe):
|
|||||||
articles = []
|
articles = []
|
||||||
soup = self.index_to_soup(self.INDEX)
|
soup = self.index_to_soup(self.INDEX)
|
||||||
|
|
||||||
for item in soup.findAll('span', attrs={'class':'toc2'}):
|
for item in soup.findAll(['h3','h4']):
|
||||||
description = ''
|
description = ''
|
||||||
title_prefix = ''
|
title_prefix = ''
|
||||||
|
|
||||||
descript_title_tag = item.findPreviousSibling('span', attrs={'class':'toc1'})
|
|
||||||
if descript_title_tag:
|
|
||||||
title_prefix = self.tag_to_string(descript_title_tag) + ' '
|
|
||||||
|
|
||||||
descript_tag = item.findNextSibling('span', attrs={'class':'toc3'})
|
|
||||||
if descript_tag:
|
|
||||||
description = self.tag_to_string(descript_tag)
|
|
||||||
|
|
||||||
feed_link = item.find('a')
|
feed_link = item.find('a')
|
||||||
if feed_link and feed_link.has_key('href'):
|
if feed_link and feed_link.has_key('href') and feed_link['href'].startswith('/cms/view.php'):
|
||||||
url = self.INDEX + feed_link['href']
|
url = self.INDEX + feed_link['href']
|
||||||
title = title_prefix + self.tag_to_string(feed_link)
|
title = title_prefix + self.tag_to_string(feed_link)
|
||||||
date = strftime(self.timefmt)
|
date = strftime(self.timefmt)
|
||||||
@ -93,14 +87,17 @@ class Vreme(BasicNewsRecipe):
|
|||||||
del item['face']
|
del item['face']
|
||||||
for item in soup.findAll(size=True):
|
for item in soup.findAll(size=True):
|
||||||
del item['size']
|
del item['size']
|
||||||
mtag = '<meta http-equiv="Content-Language" content="sr-Latn-RS"/>'
|
soup.html['lang'] = self.lang
|
||||||
soup.head.insert(0,mtag)
|
soup.html['dir' ] = self.direction
|
||||||
|
mtag = '<meta http-equiv="Content-Language" content="' + self.lang + '"/>'
|
||||||
|
mtag += '\n<meta http-equiv="Content-Type" content="text/html; charset=' + self.encoding + '"/>'
|
||||||
|
soup.head.insert(0,mtag)
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
cover_url = None
|
cover_url = None
|
||||||
soup = self.index_to_soup(self.INDEX)
|
soup = self.index_to_soup(self.INDEX)
|
||||||
cover_item = soup.find('img',attrs={'alt':'Naslovna strana broja'})
|
cover_item = soup.find('div',attrs={'id':'najava'})
|
||||||
if cover_item:
|
if cover_item:
|
||||||
cover_url = self.INDEX + cover_item['src']
|
cover_url = self.INDEX + cover_item.img['src']
|
||||||
return cover_url
|
return cover_url
|
||||||
|
Loading…
x
Reference in New Issue
Block a user