使用请求和xpath从网页提取文字

时间:2019-08-21 19:35:51

标签: python html xpath

我正在尝试提取此网站上的ACE值

https://levees.sec.usace.army.mil/#/levees/system/4305000043/system

我尝试过使用request.get和xpath来获取0.01的值,但是我的xpath似乎总是错误的

import requests
from lxml import html
pageContent=requests.get("https://levees.sec.usace.army.mil/#/levees/system/4305000043/system")
tree = html.fromstring(pageContent.content)
ACE=tree.xpath("/html/body/div[1]/div/div/ui-view/system-detail/div/two-pane-layout/div/div[1]/nld-transclude-inject/pane-left/div/div[1]/levee-system-system/div/div/div/div[3]/div[1]/div/nld-select-input/div/div/input/text()")
print(ACE)

我要打印的是0.01

0 个答案:

没有答案