国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

python - scrapy爬蟲不能循環(huán)運(yùn)行?

瀏覽:115日期:2022-07-28 11:08:58

問題描述

scrapy只能爬取一個(gè)頁面上的鏈接,不能持續(xù)運(yùn)行爬完全站,以下是代碼,初學(xué)求指導(dǎo)。

class DbbookSpider(scrapy.Spider): name = 'imufe' allowed_domains = [’http://www.imufe.edu.cn/’] start_urls=(’http://www.imufe.edu.cn/main/dtxw/201704/t20170414_127035.html’) def parse(self, response):item = DoubanbookItem()selector = scrapy.Selector(response)print(selector)books = selector.xpath(’//a/@href’).extract()link=[]for each in books: each=urljoin(response.url,each) link.append(each)for each in link: item[’link’] = each yield itemi = random.randint(0,len(link)-1)nextPage = link[i]yield scrapy.http.Request(nextPage,callback=self.parse)

問題解答

回答1:

是不是爬得太快讓封了

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 嵩明县| 平度市| 钦州市| 谢通门县| 桑植县| 望城县| 汽车| 开江县| 内黄县| 静安区| 密山市| 新安县| 临武县| 红桥区| 梅河口市| 岳池县| 石城县| 忻城县| 扎赉特旗| 姚安县| 克山县| 临桂县| 永济市| 新疆| 迁西县| 张掖市| 西乡县| 忻城县| 敦煌市| 白玉县| 台南县| 大城县| 门头沟区| 太原市| 葵青区| 石柱| 获嘉县| 德清县| 牙克石市| 客服| 宜黄县|