【发布时间】:2021-04-08 03:52:29
【问题描述】:
这是我要抓取的网页链接: https://www.tripadvisor.in/Restaurants-g494941-Indore_Indore_District_Madhya_Pradesh.html
我还应用了其他过滤器,方法是点击带圆圈的标题1
这是点击标题2后网页的样子
我想获取网页上显示的所有地点的名称,但我似乎遇到了麻烦,因为在应用过滤器时 url 没有改变。 我为此使用python urllib。 这是我的代码:
url = "https://www.tripadvisor.in/Hotels-g494941-Indore_Indore_District_Madhya_Pradesh-Hotels.html"
page = urlopen(url)
html_bytes = page.read()
html = html_bytes.decode("utf-8")
print(html)
【问题讨论】:
-
您可以尝试调用 Tripadvisor API developer-tripadvisor.com/content-api 获取结果
标签: python html python-3.x web-scraping urllib