pyspider的代码运行不了
有大佬能来看一下嘛pyspider框架下的
是用来爬取P站图片的 为什么运行不了
from pyspider.libs.base_handler import *
import os
class Handler(BaseHandler):
crawl_config = {
}
@every(minutes=24 * 60)
def on_start(self):
self.crawl('https://www.pixiv.net/', callback=self.index_page)
@config(age=10 * 24 * 60 * 60)
def index_page(self, response):
for each in response.doc("div.rp5asc-0 bscYTy a").items():
self.crawl(each.attr.href, callback=self.detail_page)
@config(priority=2)
def detail_page(self, response):
for each in response.doc("rp5asc-10 leQnFG").items():
self.crawl(each.attr.src, callback=self.detail_page2)
@config(priority=2)
def detail_page(self, response):
f=open(os.path.join("D:\\图",response.url[-10:]),'wb')
f.write(response.content)
f.close() 求救求救
页:
[1]