【发布时间】:2014-08-16 07:55:10
【问题描述】:
假设我在谷歌上搜索关键词“python%20scrape”,我怎么知道我是否可以移动到下一页?以及如何使用 python 做到这一点?
我当前的代码是:
from urllib2 import urlopen
import mechanize
import re
from bs4 import BeautifulSoup
import csv
br = mechanize.Browser()
br.addheaders = [('User-agent','Mozilla/5.0')]
br.set_handle_robots(False)
html = br.open('http://google.com/search?q=python%20scrape')
html = html.read().lower()
接下来我应该使用什么代码?
【问题讨论】:
-
对不起......无论如何,当你否决我的问题时,我正在编辑我的问题:D
-
什么不起作用?你被困在哪里了?我是否正确理解您想从 HTML 中提取“下一页”链接?
-
如果我在 google 上搜索有 645000 个结果。我怎样才能转到下一页? ...不要认为相同的链接会起作用
-
目前(并且 Google 更改了这些内容),您可以使用
start=N作为 URL 参数在第Nth 结果处开始显示结果(通常有 10每页)
标签: python google-chrome