add xinhuanet (news.cn)

Signed-off-by: icedragon <flyingicedragon@qq.com>
This commit is contained in:
icedragon
2023-05-31 15:07:15 +08:00
parent 64096acd2e
commit a0c40774cf
7 changed files with 146 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
from rsshub.utils import DEFAULT_HEADERS, fetch
def parse_html(post):
item = {}
item['title'] = post.xpath('text()').extract_first()
item['link'] = post.xpath('@href').extract_first()
print(item['link'])
item['description'] = (
fetch(item['link'], headers=DEFAULT_HEADERS)
.xpath('//div[@id=\'detail\']')
.get()
)
return item