From 532ce6ccbf878f33bab9deaf0241f990621ba7c4 Mon Sep 17 00:00:00 2001 From: YuLun Shih Date: Tue, 13 Jan 2015 22:14:16 +0800 Subject: [PATCH] recipes: add AppledailyTW --- recipes/appledaily_tw.recipe | 108 +++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 recipes/appledaily_tw.recipe diff --git a/recipes/appledaily_tw.recipe b/recipes/appledaily_tw.recipe new file mode 100644 index 0000000000..95e32b20d7 --- /dev/null +++ b/recipes/appledaily_tw.recipe @@ -0,0 +1,108 @@ +#!/usr/bin/env python + +from __future__ import unicode_literals, division, absolute_import, print_function +from calibre.web.feeds.news import BasicNewsRecipe +import re + +__license__ = 'GPL v3' +__author__ = 'YuLun Shih' + + +class AppledailyTW(BasicNewsRecipe): + __license__ = 'GPL v3' + __author__ = 'YuLun Shih' + title = u'蘋果日報 (台灣)' + description = '24 小時陪你看新聞,我們是最勁爆、最八卦、最貼近大家生活的台灣蘋果日報!' + cover_url = 'http://i.imgur.com/3pkzQbw.jpg' + masthead_url = 'http://i.imgur.com/otLZwQq.gif' + oldest_article = 1.5 + max_articles_per_feed = 25 + auto_cleanup = True + simultaneous_downloads = 25 + language = 'zh_TW' + tags = 'news, chinese, Taiwan' + category = 'news, chinese, Taiwan' + publisher = u'蘋果日報 (台灣)' + publication_type = 'newspaper' + no_stylesheets = True + remove_empty_feeds = True + extra_css = 'img { display:block; margin: 5px auto; width: 50%;}' + remove_tags = [ + {'name': 'a', 'attrs': {'href': 'mailto:.*?'}}, + {'name': 'a', 'attrs': {'target': '_blank'}}, + {'name': 'hr'} + ] + conversion_options = { + 'title' : title, + 'comments' : description, + 'tags' : category, + 'language' : language, + 'publisher' : publisher, + 'authors' : publisher, + 'linearize_tables': True + } + feeds = [ + (u'頭條', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1077'), + (u'要聞', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/11'), + (u'政治', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/151'), + (u'社會', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1066'), + (u'生活', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/2724'), + (u'地方綜合', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1076'), + (u'論壇', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/824711'), + (u'法庭', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/152'), + (u'暖流', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/9499'), + (u'投訴', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/16287'), + (u'娛樂名人', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1600'), + (u'木瓜霞吐槽', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/26153'), + (u'直擊好萊塢', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/2890'), + (u'亞洲哈燒星', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/6270'), + (u'名人時尚', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1403917'), + (u'強檔新片', 'http://www.appledaily.com.tw/rss/create/kind/col/type/35151804'), + (u'勇闖星宅門', 'http://www.appledaily.com.tw/rss/create/kind/col/type/1761666'), + (u'國際頭條', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31488833'), + (u'國際新聞', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1697'), + (u'中國新聞', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/13'), + (u'雙語天下', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1945241'), + (u'體育焦點', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/2153'), + (u'大運動場', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/16289'), + (u'籃球瘋', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/16'), + (u'投打對決', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/2154'), + (u'足球新聞', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31320925'), + (u'運彩分析', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31320926'), + (u'財經焦點', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/14'), + (u'財經熱門話題', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1059'), + (u'國際財經', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1052'), + (u'投資理財', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1028'), + (u'科技3C', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1048'), + (u'金融保險', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1078'), + (u'綜合產業', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/3847'), + (u'頭家生意', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/5050'), + (u'地產焦點', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1061'), + (u'地產王', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31425399'), + (u'中古好屋王', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31477902'), + (u'家居王', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31477866'), + (u'豪宅王', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31477901'), + (u'蘋論', 'http://www.appledaily.com.tw/rss/create/kind/col/type/974972'), + (u'司馬觀點', 'http://www.appledaily.com.tw/rss/create/kind/col/type/1635487'), + (u'人間異語', 'http://www.appledaily.com.tw/rss/create/kind/col/type/2262677'), + (u'論壇', 'http://www.appledaily.com.tw/rss/create/kind/col/type/836825'), + (u'副刊頭條', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31477907'), + (u'讓我更美', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/22'), + (u'流行尖端', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/2452'), + (u'消費高手', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1619'), + (u'旅遊與探險', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/24'), + (u'美食天地', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1898'), + (u'健康醫療', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/177600'), + (u'讓我自己來', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31478018'), + (u'寵物 DIY', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/31478020'), + (u'運勢與彩券', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/6199'), + (u'3C通訊', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/23'), + (u'車市快遞', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/1540'), + (u'名采', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/25'), + (u'人間事', 'http://www.appledaily.com.tw/rss/create/kind/sec/type/17822'), + ] + + def preprocess_raw_html(self, raw_html, url): + raw_html = re.sub(ur'