aboutsummaryrefslogtreecommitdiff
path: root/crawler/neodarznet/pipelines.py
diff options
context:
space:
mode:
Diffstat (limited to 'crawler/neodarznet/pipelines.py')
-rw-r--r--crawler/neodarznet/pipelines.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/crawler/neodarznet/pipelines.py b/crawler/neodarznet/pipelines.py
index fbfebbb..1f3a9fc 100644
--- a/crawler/neodarznet/pipelines.py
+++ b/crawler/neodarznet/pipelines.py
@@ -9,8 +9,9 @@ class NeodarznetPipeline(object):
def process_item(self, item, spider):
try:
page = Neodarznet.get(Neodarznet.url == item['url'])
- q = Neodarznet.update(**item).where(Neodarznet.url == item['url'])
- q.execute()
+ if page.content_length != item['content_length']:
+ q = Neodarznet.update(**item).where(Neodarznet.url == item['url'])
+ q.execute()
logging.info("Update item {}".format(page))
except Neodarznet.DoesNotExist:
page = Neodarznet.create(**item)