python - pyspider一下生成几千条链接爬取是否合适
ringa_lee
ringa_lee 2017-04-18 10:21:35
0
0
471

如题,在on_start()的时候直接调用key_word_rank_page()生成几千条链接,并调用self.crawl。在调试的时候没问题,但是实际运行的时候代码跑一会就不动了,数据库就没有数据写入了,taskdb库也看到这个工程的task条数没有增长

    @every(minutes=24 * 60)
    def on_start(self):
        self.key_word_rank_page()
        pass
    
    
    
    def key_word_rank_page(self):
        i = 0; page 参数从0开始的
        while i <= 3000: 
            keywordrank_url = "https://www.douban.com/more/getmore.html?page=%s&genreIds="%(i)
            self.crawl(url=keywordrank_url, callback=self.process_keyword) 
            
            i += 1;
        pass
ringa_lee
ringa_lee

ringa_lee

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!