From cc1162031db248542c19063f3e664839b7d0e763 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 23 Nov 2012 08:30:13 +0530 Subject: [PATCH] House News by Eddie Lau --- recipes/house_news.recipe | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 recipes/house_news.recipe diff --git a/recipes/house_news.recipe b/recipes/house_news.recipe new file mode 100644 index 0000000000..7d8c3275d2 --- /dev/null +++ b/recipes/house_news.recipe @@ -0,0 +1,30 @@ +__license__ = 'GPL v3' +__copyright__ = '2012, Eddie Lau' +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipeHouseNews(BasicNewsRecipe): + title = u'House News \u4e3b\u5834\u65b0\u805e' + __author__ = 'Eddie Lau' + publisher = 'House News' + oldest_article = 1 + max_articles_per_feed = 100 + auto_cleanup = False + language = 'zh' + encoding = 'utf-8' + description = 'http://thehousenews.com' + category = 'Chinese, Blogs, Opinion, News, Hong Kong' + masthead_url = 'http://thehousenews.com/static/images/housebeta.jpg' + 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%;}' + feeds = [(u'Latest', u'http://thehousenews.com/rss/')] + keep_only_tags = [dict(name='h1'), + dict(name='div', attrs={'class':['photo']}), + dict(name='p', attrs={'class':'caption'}), + dict(name='div', attrs={'class':'articleTextWrap'}), + dict(name='div', attrs={'class':['author']}), + dict(name='p', attrs={'class':'date'})] + + 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'])