用Beautifulsoup刮下一页

时间:2016-10-11 15:33:57

标签: python-2.7 beautifulsoup

我正在尝试使用BeautifulSoup进入tripadviser刮擦的下一页。下一页href如下所示:

<a href="/Hotels-g186338-oa60-London_England-Hotels.html#ACCOM_OVERVIEW" data-page-number="3" data-offset="60" class="nav next ui_button primary taLnk" onclick="ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'next', '3', 0);">Next</a>

目前我正在尝试:

url_base='https://tripadviser.co.uk/'
next_page_link = url_base + elm['href']

response = requests.get(url_base+next_page_link)
html = response.content

1 个答案:

答案 0 :(得分:0)

我更正了这段代码: response = requests.get(next_page_link)