added Hasaki crawler
This commit is contained in:
parent
5ba6894313
commit
295ac41305
|
@ -154,6 +154,18 @@ class HasakiCategoryProducts:
|
|||
pass
|
||||
|
||||
|
||||
|
||||
self.cur.execute(f"""delete from {self.config.get('crawler_schema')}.{self.config.get('tracker_tab')} where flag=1""")
|
||||
|
||||
sql = f"""
|
||||
select * from {self.config.get('crawler_schema')}.{self.config.get('tracker_tab')} where product_url = '{product_url}'
|
||||
"""
|
||||
logging.info(sql)
|
||||
self.cur.execute(sql)
|
||||
res = self.cur.fetchall()
|
||||
|
||||
if not res:
|
||||
|
||||
sql = f"""
|
||||
insert into {self.config.get('crawler_schema')}.{self.config.get('tracker_tab')}(crawler_name,product_section, product_name, product_url, product_image, product_sold, product_brand, gift, product_rank, categoryid)
|
||||
values('{self.crawler_name}','{product_section}','{product_name.replace("'","")}','{product_url}','{product_image}',{product_sold},'{product_brand}','{gift}',{product_rank},{categoryId})
|
||||
|
@ -162,6 +174,8 @@ class HasakiCategoryProducts:
|
|||
logging.info(sql)
|
||||
|
||||
self.cur.execute(sql)
|
||||
else:
|
||||
logging.info("Product already present. skipping.....")
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
|
Loading…
Reference in New Issue