Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Reset items_scraped instead of item_count

Sudhanshu Shekhare42a1ac1a1ea
diff --git a/docs/topics/extensions.rst b/docs/topics/extensions.rst
index 2c2f7fb9c..1824bcc3a 100644
--- a/docs/topics/extensions.rst
+++ b/docs/topics/extensions.rst
@@ -140,9 +140,9 @@ Here is the code of such extension::
def item_scraped(self, item, spider):
self.items_scraped += 1
- if self.items_scraped == self.item_count:
- spider.log("scraped %d items, resetting counter" % self.items_scraped)
- self.item_count = 0
+ if self.items_scraped % self.item_count == 0:
+ spider.log("scraped %d items" % self.items_scraped)
+
.. _topics-extensions-ref: