|
@@ -16,6 +16,9 @@ import random
|
|
|
from selenium.webdriver.chrome.service import Service
|
|
|
import os
|
|
|
from random import randint
|
|
|
+import pymysql
|
|
|
+pymysql.install_as_MySQLdb()
|
|
|
+
|
|
|
|
|
|
path = 'C:\portable\chromedriver'
|
|
|
path_z = '/Users/zooeytsai/Downloads/chromedriver 2'
|
|
@@ -122,6 +125,7 @@ cursor = db.query('select term,domain from seo.selected_kw')
|
|
|
for c in cursor:
|
|
|
lst.append([c['term'], c['domain']])
|
|
|
|
|
|
+
|
|
|
for i in lst:
|
|
|
print('這裡', i)
|
|
|
while True:
|
|
@@ -130,9 +134,15 @@ for i in lst:
|
|
|
time.sleep(1)
|
|
|
run_once(9928, i)
|
|
|
print('docker開啟完成')
|
|
|
+ cur = db.query('select * from seo.google_rank order by id desc limit 1')
|
|
|
+ for c in cur:
|
|
|
+ kw = c['keyword']
|
|
|
+ if kw != i[0]:
|
|
|
+ print('稍等,上一筆待完成')
|
|
|
+ time.sleep(60)
|
|
|
break
|
|
|
except:
|
|
|
os.system('docker container restart tiny9')
|
|
|
time.sleep(15)
|
|
|
print('等待進行下一個關鍵字')
|
|
|
- time.sleep(randint(180, 240))
|
|
|
+ time.sleep(5)
|