HTML 使用 Python 解析(HTML 对比完整网站)

HTML Parsing with Python (HTML vs. complete website)

我正在尝试从包含有关火车票和价格的信息(来源如下)的网站解析 html,但是我在从中取回所有 html 时遇到问题当我使用 urllib 请求 html 时的网站。

我需要的是每张票的价格,当我使用 urllib 请求 html 时,它似乎没有出现。在做了一些调查工作后,我确定如果我用 chrome 和 select "HTML only" 保存网页,我不会得到价格,但是如果我 select "Complete WebPage," 我愿意。无论如何可以查看我下载 "Complete Webpage" 并在 python 中使用它时获得的 HTML。或者有没有办法自动下载完整的网页并使用下载的文件在python中解析。

谢谢, 乔治

https://www.raileurope.com/en/us/point_to_point/ptp_results.htm?execution=e3s1&resultId=147840746&cobrand=public&saleCountry=us&resultId=147840746&cobrand=public&saleCountry=us&itemId=-1&fn=fsRequest&cobrand=public&c=USD&roundtrip=0&isAtocRequest=0&georequest=1&lang=en&route-type=0&from0=paris&to0=amsterdam&deptDate0=06%2F07%2F2017&time0=8&pass-question-radio=1&nCountries=&selCountry1=&selCountry2=&selCountry3=&selCountry4=&selCountry5=&familyId=&p=0&additionalTraveler0=adult&additionalTravelerAge0=&paxIds=&nA=1&nY=0&nC=0&nS=0

看看selenium
由于网站是JS渲染的,所以需要用webdriver来模拟"Click".
你需要一个爬虫而不是一个简单的爬虫