jared 3 년 전
부모
커밋
d08dcd5a35
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      swire_shop_item_list.py

+ 11 - 1
swire_shop_item_list.py

@@ -26,6 +26,7 @@ import brotli
 from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
 
 chrome_window=False
+globalkw=None
 
 def brower_start(port):
     options = webdriver.ChromeOptions()
@@ -88,13 +89,19 @@ def keyin_keyword(driver, keyword):
 
 
 def get_next_job(db):
+    global globalkw
+
     result={}
-    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')
     for c in cursor:
         result['kw']=c['kw']
         result['num']=c['num']
         break
 
+
     cursor = db.query('select lat,lon,loc from lat_lon_loc where num ="'+str(result['num'])+'"')
     for c in cursor:
         result['lat']=c['lat']
@@ -173,6 +180,9 @@ def process_web_request(driver,area_num,keyword):
 def main():
     global chrome_window
     global store_list_table
+    global globalkw
+    if len(sys.argv)>1:
+        globalkw=sys.argv[1]
     failcnt=0
     localip=socket.gethostbyname(socket.gethostname())
     if localip=='192.168.1.108':