mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-20 15:09:40 +00:00
fix xpath error in xinhuanet world
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
from time import sleep
|
||||||
from rsshub.utils import DEFAULT_HEADERS, fetch
|
from rsshub.utils import DEFAULT_HEADERS, fetch
|
||||||
|
|
||||||
|
|
||||||
@@ -5,10 +6,11 @@ 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()
|
||||||
print(item['link'])
|
html = fetch(item['link'], headers=DEFAULT_HEADERS)
|
||||||
item['description'] = (
|
item['description'] = (
|
||||||
fetch(item['link'], headers=DEFAULT_HEADERS)
|
html
|
||||||
.xpath('//div[@id=\'detail\']')
|
.xpath('//div[@id="detail"]')
|
||||||
.get()
|
.get()
|
||||||
)
|
)
|
||||||
return item
|
sleep(1)
|
||||||
|
return item
|
||||||
Reference in New Issue
Block a user