From 9683d93dc81f7803c2a1a82f9d64e7605feadce1 Mon Sep 17 00:00:00 2001 From: Kennyl Date: Mon, 23 Jan 2017 23:35:02 +0800 Subject: [PATCH 1/4] Better translation on nav bar Translate navbar to brief chinese word from feedback --- recipes/apple_daily.recipe | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/apple_daily.recipe b/recipes/apple_daily.recipe index 728609d776..3f8963321e 100644 --- a/recipes/apple_daily.recipe +++ b/recipes/apple_daily.recipe @@ -262,8 +262,8 @@ class AppleDaily(BasicNewsRecipe): not self.has_single_feed, a.orig_url, __appname__, prefix=prefix, center=self.center_navbar) - elem = BeautifulSoup(templ.render( - doctype='xhtml').decode('utf-8')).find('div') + translatedTempl =re.sub('
.*

','
蘋果日報下載至'+__appname__+'

',templ.render(doctype='xhtml').decode('utf-8'),flags=re.S) + elem = BeautifulSoup(translatedTempl).find('div') body.insert(len(body.contents), elem) with open(last, 'wb') as fi: fi.write(unicode(soup).encode('utf-8')) From 9ab3fa57fc304ebfadc904d60ed4c70a562cb86a Mon Sep 17 00:00:00 2001 From: Kennyl Date: Mon, 23 Jan 2017 23:36:24 +0800 Subject: [PATCH 2/4] Better Cover Image Better Cover Image from wikimedia --- recipes/apple_daily.recipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/apple_daily.recipe b/recipes/apple_daily.recipe index 3f8963321e..2a85ff01bc 100644 --- a/recipes/apple_daily.recipe +++ b/recipes/apple_daily.recipe @@ -34,7 +34,7 @@ class AppleDaily(BasicNewsRecipe): no_stylesheets = True description = 'http://hkm.appledaily.com/' category = 'Chinese, News, Hong Kong' - masthead_url = 'https://upload.wikimedia.org/wikipedia/zh/thumb/5/52/Apple_Daily_logo.svg/569px-Apple_Daily_logo.svg.png' + masthead_url = 'https://upload.wikimedia.org/wikipedia/commons/8/86/Apple_Daily_Title.svg' extra_css = 'img {display: block; margin-left: auto; margin-right: auto; margin-top: 10px; margin-bottom: 10px; max-height:90%;} h1 {font-size:200%; text-align:left; font-weight:bold;} p[class=video-caption] {font-size:50%; margin-left:auto; margin-right:auto;}' # noqa keep_only_tags = [dict(name='div', attrs={'id': 'content-article'})] From f1088f4f53a381ca0f6d19eb2e5cec2eacfa3d5c Mon Sep 17 00:00:00 2001 From: Kennyl Date: Mon, 23 Jan 2017 23:38:00 +0800 Subject: [PATCH 3/4] New Download Logic Less Hard Code --- recipes/apple_daily.recipe | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/recipes/apple_daily.recipe b/recipes/apple_daily.recipe index 2a85ff01bc..be0f3b6196 100644 --- a/recipes/apple_daily.recipe +++ b/recipes/apple_daily.recipe @@ -105,16 +105,17 @@ class AppleDaily(BasicNewsRecipe): relativea = li.find('a', href=True).get('href', False) a = 'http://hkm.appledaily.com/' + relativea title = li.find('a', text=True).strip() - if (time.tzname != 'HKT'): - if (title == u'三藩市'): - continue - if (title == u'洛杉磯'): - continue - if (title == u'紐  約'): - continue - if (title == u'美  國'): - continue - if (not title == u'動新聞') and (relativea.startswith('list.php')): + # if (time.tzname != 'HKT'): + # if (title == u'三藩市'): + # continue + # if (title == u'洛杉磯'): + # continue + # if (title == u'紐  約'): + # continue + # if (title == u'美  國'): + # continue + # if (not title == u'動新聞') and (relativea.startswith('list.php')): + if (relativea.find('category=daily')!= -1 )and (relativea.startswith('list.php')): sectionList.append((title, a)) for title, url in sectionList: title = title.replace(" ", "") From 0baff37fd0c20a75a7768983e930c57dc18f9cff Mon Sep 17 00:00:00 2001 From: Kennyl Date: Mon, 23 Jan 2017 23:43:37 +0800 Subject: [PATCH 4/4] Change Font Size From 12 to 10 for better experience in ereader --- recipes/apple_daily.recipe | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/apple_daily.recipe b/recipes/apple_daily.recipe index be0f3b6196..0586d2ebc2 100644 --- a/recipes/apple_daily.recipe +++ b/recipes/apple_daily.recipe @@ -36,6 +36,8 @@ class AppleDaily(BasicNewsRecipe): category = 'Chinese, News, Hong Kong' masthead_url = 'https://upload.wikimedia.org/wikipedia/commons/8/86/Apple_Daily_Title.svg' + conversion_options = { 'base_font_size' : 10 } + extra_css = 'img {display: block; margin-left: auto; margin-right: auto; margin-top: 10px; margin-bottom: 10px; max-height:90%;} h1 {font-size:200%; text-align:left; font-weight:bold;} p[class=video-caption] {font-size:50%; margin-left:auto; margin-right:auto;}' # noqa keep_only_tags = [dict(name='div', attrs={'id': 'content-article'})] remove_tags = [dict(name='div', attrs={'class': 'prev-next-btn'}),