4
__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
9
from calibre.web.feeds.news import BasicNewsRecipe
10
from calibre.ebooks.BeautifulSoup import Tag
12
class AccountancyAge(BasicNewsRecipe):
13
title = 'Accountancy Age'
14
__author__ = 'Darko Miletic'
15
description = 'business news'
16
publisher = 'accountancyage.com'
17
category = 'news, politics, finances'
19
max_articles_per_feed = 100
21
use_embedded_content = False
22
simultaneous_downloads = 1
25
language = _('English')
28
'--comment', description
29
, '--category', category
30
, '--publisher', publisher
33
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
35
keep_only_tags = [dict(name='div', attrs={'class':'bodycol'})]
36
remove_tags = [dict(name=['embed','object'])]
37
remove_tags_after = dict(name='div', attrs={'id':'permalink'})
38
remove_tags_before = dict(name='div', attrs={'class':'gap6'})
40
feeds = [(u'All News', u'http://feeds.accountancyage.com/rss/latest/accountancyage/all')]
42
def print_version(self, url):
43
rest, sep, miss = url.rpartition('/')
44
rr, ssep, artid = rest.rpartition('/')
45
return u'http://www.accountancyage.com/articles/print/' + artid
47
def get_article_url(self, article):
48
return article.get('guid', None)
50
def preprocess_html(self, soup):
51
soup.html['xml:lang'] = self.lang
52
soup.html['lang'] = self.lang
53
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
54
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=UTF-8")])
55
soup.head.insert(0,mlang)
56
soup.head.insert(1,mcharset)
57
return self.adeify_images(soup)