xpath提取问题
各位大佬,请教一下我想提取以下网址中的内容,但是发现提取内容为空,不知道问题在哪里。网址:https://elines.coscoshipping.com/ebusiness/cargoTracking?trackingType=CONTAINER&number=TCKU7192082
希望提取内容:
①集装箱号:TCKU7192082
②预计到港:2021-04-17 06:00
我的xpath代码:
response.xpath("//div[@class='cntrSelfPart ivu-col ivu-col-span-6']/p[@class='cntrNumber']/text()").extract()
response.xpath("//div[@class='ETA ivu-col ivu-col-span-10']/p[@class='date']/text()").extract()
https://z3.ax1x.com/2021/04/10/ca0ipd.jpg 箱号是链接里送上去的,预计到达时间是ajax获取的,带上时间戳就能获取到:
import requests
def main():
url = 'https://elines.coscoshipping.com/ebtracking/public/container/eta/TCKU7192082?timestamp=1618121118210'
headers = {'user-agent': 'firefox'}
r = requests.get(url, headers=headers)
print(r.text)
if __name__ == '__main__':
main()
时间戳就是当前系统的秒数
页:
[1]