试图从列表中刮取数据,但由于某些原因,它返回空。类似的代码在其他网站上也起到了作用,我很困惑为什么它在这个网站上不起作用。请帮忙!
import requests
from lxml import html
start_url ="https://www.anybusiness.com.au/search?page=1&sort=date-new-old"
res = requests.get(start_url)
tree = html.fromstring(res.content)
# Retrieve listing title
title_xpath = "/html/body/div[2]/section/div[2]/div/div[2]/div[2]/div/a/div/div/text()"
title_value= tree.xpath(title_xpath)
print(title_value)
>> []
1条答案
按热度按时间elcex8rz1#
输出:
最新答复:
输出: