我正在嘗試scrapy的規則/鏈接提取器。回叫沒有在scrapy中調用
「restrict_css」下的css是正確的,我可以在scrapy shell中檢索使用response.css的鏈接,但是由於某種原因,當我在蜘蛛uner規則和鏈接提取器中運行這個函數時,並沒有調用parse_product回調函數。
rules=(
Rule(LinkExtractor(restrict_css='a.i-next')),
Rule(LinkExtractor(restrict_css='div.product-image-wrapper>a'),
callback='parse_product'),
)
def parse_product(self, response):
print("Print anything for testing")
return
謝謝,任何幫助,將不勝感激。
你在爬行什麼頁面? – Granitosaurus
allowed_domains = ['http://www.orsay.com/de-de/'] start_urls = ['http://www.orsay.com/de-de/'] –