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中解析。
谢谢,
乔治
看看selenium
由于网站是JS渲染的,所以需要用webdriver来模拟"Click".
你需要一个爬虫而不是一个简单的爬虫
我正在尝试从包含有关火车票和价格的信息(来源如下)的网站解析 html,但是我在从中取回所有 html 时遇到问题当我使用 urllib 请求 html 时的网站。
我需要的是每张票的价格,当我使用 urllib 请求 html 时,它似乎没有出现。在做了一些调查工作后,我确定如果我用 chrome 和 select "HTML only" 保存网页,我不会得到价格,但是如果我 select "Complete WebPage," 我愿意。无论如何可以查看我下载 "Complete Webpage" 并在 python 中使用它时获得的 HTML。或者有没有办法自动下载完整的网页并使用下载的文件在python中解析。
谢谢, 乔治
看看selenium
由于网站是JS渲染的,所以需要用webdriver来模拟"Click".
你需要一个爬虫而不是一个简单的爬虫