mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update People Daily
This commit is contained in:
parent
ec3744c661
commit
268d1d991c
@ -9,7 +9,7 @@ class AdvancedUserRecipe1277129332(BasicNewsRecipe):
|
|||||||
title = u'人民日报'
|
title = u'人民日报'
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
__author__ = 'zzh'
|
__author__ = 'ceapas'
|
||||||
|
|
||||||
pubisher = 'people.com.cn'
|
pubisher = 'people.com.cn'
|
||||||
description = 'People Daily Newspaper'
|
description = 'People Daily Newspaper'
|
||||||
@ -70,16 +70,16 @@ class AdvancedUserRecipe1277129332(BasicNewsRecipe):
|
|||||||
# (u'中国人大新闻', u'http://www.people.com.cn/rss/14576.xml'),
|
# (u'中国人大新闻', u'http://www.people.com.cn/rss/14576.xml'),
|
||||||
# (u'中国政协新闻', u'http://www.people.com.cn/rss/34948.xml'),
|
# (u'中国政协新闻', u'http://www.people.com.cn/rss/34948.xml'),
|
||||||
]
|
]
|
||||||
keep_only_tags = [
|
# keep_only_tags = [
|
||||||
dict(name='div', attrs={'class': 'text_c'}),
|
# dict(name='p'),
|
||||||
]
|
# ]
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name='div', attrs={'class': 'tools'}),
|
dict(name='div', class_="channel cf")
|
||||||
]
|
|
||||||
remove_tags_after = [
|
|
||||||
dict(name='div', attrs={'id': 'p_content'}),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
remove_tags_before = [dict(name='div', class_="layout rm_txt cf")]
|
||||||
|
remove_tags_after = [dict(name='div', class_="edit cf")]
|
||||||
|
|
||||||
def append_page(self, soup, appendtag, position):
|
def append_page(self, soup, appendtag, position):
|
||||||
pager = soup.find('img', attrs={'src': '/img/next_b.gif'})
|
pager = soup.find('img', attrs={'src': '/img/next_b.gif'})
|
||||||
if pager:
|
if pager:
|
||||||
@ -101,8 +101,7 @@ class AdvancedUserRecipe1277129332(BasicNewsRecipe):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
mtag = '<meta http-equiv="content-type" content="text/html;charset=GB2312" />\n<meta http-equiv="content-language" content="GB2312" />'
|
|
||||||
soup.head.insert(0, mtag)
|
|
||||||
for item in soup.findAll(style=True):
|
for item in soup.findAll(style=True):
|
||||||
del item['form']
|
del item['form']
|
||||||
self.append_page(soup, soup.body, 3)
|
self.append_page(soup, soup.body, 3)
|
||||||
@ -115,8 +114,8 @@ class AdvancedUserRecipe1277129332(BasicNewsRecipe):
|
|||||||
year = time.strftime('%Y')
|
year = time.strftime('%Y')
|
||||||
month = time.strftime('%m')
|
month = time.strftime('%m')
|
||||||
day = time.strftime('%d')
|
day = time.strftime('%d')
|
||||||
cover = 'http://paper.people.com.cn/rmrb/page/' + year + '-' + \
|
cover = 'http://paper.people.com.cn/rmrb/images/' + year + '-' + \
|
||||||
month + '/' + day + '/01/RMRB' + year + month + day + 'B001_b.jpg'
|
month + '/' + day + '/01/rmrb' + year + month + day + '01_b.jpg'
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
try:
|
try:
|
||||||
br.open(cover)
|
br.open(cover)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user