fall back to xinhuanet world

This commit is contained in:
Zhihai Liao
2023-07-01 22:56:58 +00:00
parent b5a20ee96a
commit b9bb677cd0

View File

@@ -1,4 +1,3 @@
from time import sleep
from rsshub.utils import DEFAULT_HEADERS, fetch from rsshub.utils import DEFAULT_HEADERS, fetch
@@ -6,10 +5,10 @@ def parse_html(post):
item = {} item = {}
item['title'] = post.xpath('text()').extract_first() item['title'] = post.xpath('text()').extract_first()
item['link'] = post.xpath('@href').extract_first() item['link'] = post.xpath('@href').extract_first()
html = fetch(item['link'], headers=DEFAULT_HEADERS) print(item['link'])
item['description'] = ( item['description'] = (
html fetch(item['link'], headers=DEFAULT_HEADERS)
.xpath('//div[@id="detail"]') .xpath('//div[@id=\'detail\']')
.get() .get()
) )
return item return item