0
我想利用scrapy收集谷歌搜索結果並將它們放到MongoDB中。但是,我沒有得到任何答覆......我錯過了什麼?Scrapy和谷歌網頁抓取
看起來很簡單。
# -*- coding: utf-8 -*-
import scrapy
class GoogleSpider(scrapy.Spider):
name = "google"
allowed_domains = ["google.com"]
start_urls = (
'https://www.google.com/#q=site:www.linkedin.com%2Fpub+intext:(security+or+jsp)+and+(power+or+utility)',
)
def parse(self, response):
for sel in response.xpath('//*[@id="rso"]/div/div[1]/div/h3'):
title = sel.xpath('a/text()').extract()
link = sel.xpath('a/@href').extract()
desc = sel.xpath('text()').extract()
print title, link, desc
pass