mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Update Nikkei News
This commit is contained in:
parent
b86ebc076f
commit
556221fdf4
@ -1,13 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
import re
|
||||
|
||||
import unicodedata
|
||||
|
||||
# import pprint, sys
|
||||
# pp = pprint.PrettyPrinter(indent=4)
|
||||
|
||||
class NikkeiNet_paper_subscription(BasicNewsRecipe):
|
||||
title = u'\u65E5\u672C\u7D4C\u6E08\u65B0\u805E\uFF08\u671D\u520A\u30FB\u5915\u520A\uFF09'
|
||||
__author__ = 'Ado Nishimura'
|
||||
description = u'\u65E5\u7D4C\u96FB\u5B50\u7248\u306B\u3088\u308B\u65E5\u672C\u7D4C\u6E08\u65B0\u805E\u3002\u671D\u520A\u30FB\u5915\u520A\u306F\u53D6\u5F97\u6642\u9593\u306B\u3088\u308A\u5207\u308A\u66FF\u308F\u308A\u307E\u3059\u3002\u8981\u8CFC\u8AAD'
|
||||
description = u'\u65E5\u7D4C\u96FB\u5B50\u7248\u306B\u3088\u308B\u65E5\u672C\u7D4C\u6E08\u65B0\u805E\u3002\u671D\u520A\u30FB\u5915\u520A\u306F\u53D6\u5F97\u6642\u9593\u306B\u3088\u308A\u5207\u308A\u66FF\u308F\u308A\u307E\u3059\u3002\u8981\u8CFC\u8AAD' # noqa
|
||||
needs_subscription = True
|
||||
oldest_article = 1
|
||||
max_articles_per_feed = 30
|
||||
@ -100,7 +104,11 @@ class NikkeiNet_paper_subscription(BasicNewsRecipe):
|
||||
return result
|
||||
|
||||
def populate_article_metadata(self, article, soup, first):
|
||||
elm = soup.find('div', {"class":"cmn-article_text JSID_key_fonttxt"})
|
||||
elm_text = ''.join([s.string for s in elm])
|
||||
article.summary = elm_text
|
||||
article.text_summary = elm_text
|
||||
try:
|
||||
elms = soup.findAll('div', {"class":"cmn-article_text JSID_key_fonttxt"})
|
||||
elm_text = u'◆'.join([self.tag_to_string(elm).strip() for elm in elms])
|
||||
elm_text = unicodedata.normalize('NFKC', elm_text)
|
||||
article.summary = article.text_summary = elm_text
|
||||
except:
|
||||
self.log("Error: Failed to get article summary.")
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user