Fix #1015584 (Updated recipe for Akter)

This commit is contained in:
Kovid Goyal 2012-06-20 20:05:54 +05:30
parent 8749535bd6
commit 7529eebed0

View File

@ -1,5 +1,5 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2010-2012, Darko Miletic <darko.miletic at gmail.com>'
''' '''
akter.co.rs akter.co.rs
''' '''
@ -8,7 +8,7 @@ import re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class Akter(BasicNewsRecipe): class Akter(BasicNewsRecipe):
title = 'AKTER' title = 'AKTER - Nedeljnik'
__author__ = 'Darko Miletic' __author__ = 'Darko Miletic'
description = 'AKTER - nedeljni politicki magazin savremene Srbije' description = 'AKTER - nedeljni politicki magazin savremene Srbije'
publisher = 'Akter Media Group d.o.o.' publisher = 'Akter Media Group d.o.o.'
@ -18,61 +18,37 @@ class Akter(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
use_embedded_content = False use_embedded_content = False
encoding = 'utf-8' encoding = 'utf-8'
masthead_url = 'http://www.akter.co.rs/templates/gk_thenews2/images/style2/logo.png' masthead_url = 'http://www.akter.co.rs/gfx/logoneover.png'
language = 'sr' language = 'sr'
publication_type = 'magazine' publication_type = 'magazine'
remove_empty_feeds = True remove_empty_feeds = True
PREFIX = 'http://www.akter.co.rs'
extra_css = """ extra_css = """
@font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)}
.article_description,body{font-family: Arial,Helvetica,sans1,sans-serif} body{font-family: Tahoma,Geneva,sans1,sans-serif}
.color-2{display:block; margin-bottom: 10px; padding: 5px, 10px; img{margin-bottom: 0.8em; display: block;}
border-left: 1px solid #D00000; color: #D00000} """
img{margin-bottom: 0.8em} """
conversion_options = { conversion_options = {
'comment' : description 'comment' : description
, 'tags' : category , 'tags' : category
, 'publisher': publisher , 'publisher': publisher
, 'language' : language , 'language' : language
, 'linearize_tables' : True
} }
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
keep_only_tags = [dict(name='div', attrs={'id':'section_to_print'})]
feeds = [ feeds = [(u'Nedeljnik', u'http://akter.co.rs/rss/nedeljnik')]
(u'Politika' , u'http://www.akter.co.rs/index.php/politikaprint.html' )
,(u'Ekonomija' , u'http://www.akter.co.rs/index.php/ekonomijaprint.html')
,(u'Life&Style' , u'http://www.akter.co.rs/index.php/lsprint.html' )
,(u'Sport' , u'http://www.akter.co.rs/index.php/sportprint.html' )
]
def preprocess_html(self, soup):
for item in soup.findAll(style=True):
del item['style']
return self.adeify_images(soup)
def print_version(self, url): def print_version(self, url):
return url + '?tmpl=component&print=1&page=' dpart, spart, apart = url.rpartition('/')
return dpart + '/print-' + apart
def parse_index(self): def get_cover_url(self):
totalfeeds = [] soup = self.index_to_soup('http://www.akter.co.rs/weekly.html')
lfeeds = self.get_feeds() divt = soup.find('div', attrs={'class':'lastissue'})
for feedobj in lfeeds: if divt:
feedtitle, feedurl = feedobj imgt = divt.find('img')
self.report_progress(0, _('Fetching feed')+' %s...'%(feedtitle if feedtitle else feedurl)) if imgt:
articles = [] return 'http://www.akter.co.rs' + imgt['src']
soup = self.index_to_soup(feedurl) return None
for item in soup.findAll(attrs={'class':['sectiontableentry1','sectiontableentry2']}):
link = item.find('a')
url = self.PREFIX + link['href']
title = self.tag_to_string(link)
articles.append({
'title' :title
,'date' :''
,'url' :url
,'description':''
})
totalfeeds.append((feedtitle, articles))
return totalfeeds