calibre/recipes/house_news.recipe
Kovid Goyal 567040ee1e Perform PEP8 compliance checks on the entire codebase
Some bits of PEP 8 are turned off via setup.cfg
2016-07-29 21:25:17 +05:30

32 lines
1.6 KiB
Plaintext

__license__ = 'GPL v3'
__copyright__ = '2012-2015, Eddie Lau'
from calibre.web.feeds.news import BasicNewsRecipe
class AdvancedUserRecipeHouseNews(BasicNewsRecipe):
title = u'The House News Bloggers 主場博客'
__author__ = 'Eddie Lau'
publisher = 'The House News Bloggers'
oldest_article = 1
max_articles_per_feed = 100
auto_cleanup = False
no_stylesheets = True
language = 'zh'
encoding = 'utf-8'
description = 'http://thehousenewsbloggers.net'
category = 'Chinese, Blogs, Opinion, News, Hong Kong'
masthead_url = 'http://thehousenewsbloggers.files.wordpress.com/2014/09/screen-shot-2014-09-11-at-8-55-13.png'
extra_css = 'img {display: block; margin-left: auto; margin-right: auto; margin-top: 10px; margin-bottom: 10px; max-height:90%;} p[class=date] {font-size:50%;} div[class=author] {font-size:75%;} p[class=caption] {font-size:50%;}' # noqa
feeds = [(u'Latest', u'http://thehousenewsbloggers.net/feed/')]
keep_only_tags = [dict(name='h1', attrs={'class': ['title']}),
dict(name='span', attrs={'class': ['author vcard']}),
dict(name='time', attrs={'class': ['entry-date']}),
dict(name='section', attrs={'class': ['entry']})]
remove_tags = [dict(name='div', attrs={'id': ['jp-post-flair']})]
def populate_article_metadata(self, article, soup, first):
if first and hasattr(self, 'add_toc_thumbnail'):
picdiv = soup.find('img')
if picdiv is not None:
self.add_toc_thumbnail(article, picdiv['src'])