निम्नलिखित कोडमकड़ी की कोशिश करते समय और साइट को पार्स करने के दौरान स्केपर मेरे लिए त्रुटि क्यों फेंकता है?
class SiteSpider(BaseSpider):
name = "some_site.com"
allowed_domains = ["some_site.com"]
start_urls = [
"some_site.com/something/another/PRODUCT-CATEGORY1_10652_-1__85667",
]
rules = (
Rule(SgmlLinkExtractor(allow=('some_site.com/something/another/PRODUCT-CATEGORY_(.*)',))),
# Extract links matching 'item.php' and parse them with the spider's method parse_item
Rule(SgmlLinkExtractor(allow=('some_site.com/something/another/PRODUCT-DETAIL(.*)',)), callback="parse_item"),
)
def parse_item(self, response):
.... parse stuff
निम्न त्रुटि फेंकता
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1174, in mainLoop
self.runUntilCurrent()
File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 796, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 318, in callback
self._startRunCallbacks(result)
File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 424, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 441, in _runCallbacks
self.result = callback(self.result, *args, **kw)
File "/usr/lib/pymodules/python2.6/scrapy/spider.py", line 62, in parse
raise NotImplementedError
exceptions.NotImplementedError:
जब मैं कॉलबैक "पार्स" करने के लिए और समारोह "पार्स करने के लिए" मैं किसी भी त्रुटि नहीं मिलता है बदलने के लिए, लेकिन कुछ भी नहीं है स्क्रैप। मैंने इसे "parse_items" में बदल दिया है, सोच रहा हूं कि मैं parse method by accident को ओवरराइड कर सकता हूं। शायद मैं लिंक निकालने वाला गलत स्थापित कर रहा हूं?
मैं क्या करना चाहता हूं वह प्रत्येक पृष्ठ लिंक को CATEGORY पृष्ठ पर पार्स करना है। क्या मैं यह पूरी तरह से गलत कर रहा हूँ?
भी: http://stackoverflow.com/questions/1811132/scrapy-sgmllinkextractor-is-ignoring-allowed-links – bdd