|
@@ -92,10 +92,13 @@ def get_next_job(db):
|
|
|
global globalkw
|
|
|
|
|
|
result={}
|
|
|
- if globalkw is not None:
|
|
|
- cursor = db.query('select distinct(kw),num+1 as num from swire_progress_list where kw="'+globalkw+'"')
|
|
|
- else:
|
|
|
- cursor = db.query('select distinct(kw),num+1 as num from swire_progress_list where num < 367 order by rand() limit 1')
|
|
|
+# if globalkw is not None:
|
|
|
+# cursor = db.query('select distinct(kw),num+1 as num from swire_progress_list where kw="'+globalkw+'"')
|
|
|
+# else:
|
|
|
+# cursor = db.query('select distinct(kw),num+1 as num from swire_progress_list where num < 367 order by rand() limit 1')
|
|
|
+
|
|
|
+ cursor = db.query('select kw,num from areacodes where expand=0 order by rand()')
|
|
|
+
|
|
|
for c in cursor:
|
|
|
result['kw']=c['kw']
|
|
|
result['num']=c['num']
|
|
@@ -192,7 +195,8 @@ def main():
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/google_poi?charset=utf8mb4')
|
|
|
store_list_table = db['swire_store_list']
|
|
|
|
|
|
- table2 = db['swire_progress_list']
|
|
|
+# table2 = db['swire_progress_list']
|
|
|
+ table2 = db['swire_area_progress']
|
|
|
|
|
|
|
|
|
port=4444
|
|
@@ -231,7 +235,8 @@ def main():
|
|
|
# driver.implicitly_wait(30)
|
|
|
ActionChains(driver).move_to_element(element).click(element).perform()
|
|
|
process_web_request(driver,area_num,keyword)
|
|
|
- table2.upsert({'kw':keyword,'num':job['num']},['kw'])
|
|
|
+# table2.upsert({'kw':keyword,'num':job['num']},['kw'])
|
|
|
+ table2.insert({'kw':keyword,'num':job['num']},['kw'])
|
|
|
|
|
|
except:
|
|
|
traceback.print_exc()
|