added Hasaki crawler
This commit is contained in:
parent
5ba6894313
commit
295ac41305
|
@ -154,14 +154,28 @@ class HasakiCategoryProducts:
|
|||
pass
|
||||
|
||||
|
||||
|
||||
self.cur.execute(f"""delete from {self.config.get('crawler_schema')}.{self.config.get('tracker_tab')} where flag=1""")
|
||||
|
||||
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})
|
||||
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})
|
||||
"""
|
||||
|
||||
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