37,719
社区成员
发帖
与我相关
我的任务
分享
2017-03-15 08:49:11 [scrapy.spidermiddlewares.offsite] DEBUG: Filtered offsite request to 'detail.tmall.com': <GET https://detail.tmall.com/item.htm?id=521811263733>
2017-03-15 08:49:11 [scrapy.core.engine] INFO: Closing spider (finished)
2017-03-15 08:49:11 [scrapy.core.engine] ERROR: Scraper close failure
Traceback (most recent call last):
File "e:\python35\lib\site-packages\twisted\internet\defer.py", line 653, in _runCallbacks
current.result = callback(current.result, *args, **kw)
TypeError: close_spider() takes 1 positional argument but 2 were given
class MyxdSpider(scrapy.Spider):
name = "myxd"
allowed_domains = ["miaoyuxiaodiaosp.tmall.com"]
start_urls = ['http://miaoyuxiaodiaosp.tmall.com/']
def parse(self, response):
url = "https://miaoyuxiaodiaosp.tmall.com/search.htm"
yield Request(url=url, callback=self.page)
def page(self, response):
urldata = response.xpath("//div[@class='item4line1']//dl/@data-id").extract()
# print(urldata)
# print(len(urldata))
for j in range(0, len(urldata)):
thisid = urldata[j]
urll = "https://detail.tmall.com/item.htm?id=" + str(thisid)
# print(urll)
yield Request(url=urll, callback=self.final_buzou)
def final_buzou(self, response):
print(response.url)