【发布时间】:2015-10-29 12:54:34
【问题描述】:
当我尝试在 Google 上抓取搜索结果时,Scrapy 只会生成 Google 主页: http://pastebin.com/FUbvbhN4
这是我的蜘蛛:
import scrapy
class GoogleFinanceSpider(scrapy.Spider):
name = "google"
start_urls = ['http://www.google.com/#q=finance.google.com:+3m+co']
allowed_domains = ['www.google.com']
def parse(self, response):
filename = response.url.split("/")[-2] + '.html'
with open(filename, 'wb') as f:
f.write(response.body)
这个网址作为起始网址有问题吗?当我在浏览器中打开它时——将它放在地址栏中(而不是填写搜索表单)——我会得到有效的搜索结果。
【问题讨论】:
标签: scrapy