|
@@ -271,6 +271,8 @@ def save_js_to_db(jsobj,num,keyword):
|
|
|
# store_list_table.upsert(r,keys=['place_id'])
|
|
|
|
|
|
def process_web_request(driver,area_num,keyword):
|
|
|
+ global db
|
|
|
+ global prev_cnt
|
|
|
# query = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.XPATH, '//button[@vet="19128"]')))
|
|
|
time.sleep(0.8)
|
|
|
time.sleep(3)
|
|
@@ -292,6 +294,15 @@ def process_web_request(driver,area_num,keyword):
|
|
|
save_js_to_db(resultobj,area_num,keyword)
|
|
|
print("after",datetime.now())
|
|
|
|
|
|
+ aft_cnt=0
|
|
|
+ cursor = db.query('select count(*) as cnt from swire_store_list where num="'+str(area_num)+'" ')
|
|
|
+ for c in cursor:
|
|
|
+ aft_cnt=c['cnt']
|
|
|
+ break
|
|
|
+ db['conv_log'].insert({'num':area_num,'prev':prev_cnt,'next':aft_cnt,'dt':datetime.now()})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
# time.sleep(9999)
|
|
|
|
|
|
|
|
@@ -301,6 +312,7 @@ def main():
|
|
|
global globalkw
|
|
|
global proxyport
|
|
|
global iddict
|
|
|
+ global prev_cnt
|
|
|
|
|
|
if len(sys.argv)>1:
|
|
|
globalkw=sys.argv[1]
|
|
@@ -382,12 +394,6 @@ def main():
|
|
|
pagecnt+=1
|
|
|
if pagecnt>=5:
|
|
|
break
|
|
|
- aft_cnt=0
|
|
|
- cursor = db.query('select count(*) as cnt from swire_store_list where num="'+str(area_num)+'" ')
|
|
|
- for c in cursor:
|
|
|
- aft_cnt=c['cnt']
|
|
|
- break
|
|
|
- db['conv_log'].insert({'num':area_num,'prev':prev_cnt,'next':aft_cnt,'dt':datetime.now()})
|
|
|
|
|
|
|
|
|
# table2.upsert({'kw':keyword,'num':job['num']},['kw'])
|