|
@@ -18,7 +18,9 @@ import time
|
|
|
import traceback
|
|
|
import sys
|
|
|
import fire
|
|
|
-
|
|
|
+import pymysql
|
|
|
+pymysql.install_as_MySQLdb()
|
|
|
+from ig_tags import setting
|
|
|
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
|
table=db['general_log']
|
|
@@ -45,7 +47,7 @@ def process_query(qs):
|
|
|
driver.get(googleurl)
|
|
|
time.sleep(6)
|
|
|
|
|
|
- elmts=driver.find_elements(By.XPATH,"//div[@class='yuRUbf']/a")
|
|
|
+ elmts=driver.find_elements(By.T,"//div[@class='yuRUbf']/a")
|
|
|
|
|
|
idx=1
|
|
|
ranking=-1
|
|
@@ -72,11 +74,12 @@ def run_once(q):
|
|
|
global driver
|
|
|
result=[]
|
|
|
s = Service('/root/driver/chromedriver')
|
|
|
+ user_agent = setting.rua()
|
|
|
options = webdriver.ChromeOptions()
|
|
|
options.add_argument('--headless')
|
|
|
options.add_argument('--remote-debugging-port=9222')
|
|
|
- options.add_experimental_option("debuggerAddress", "192.168.192.156:9922")
|
|
|
- # options.add_argument("--user-agent=" +user_agent)
|
|
|
+ options.add_experimental_option("debuggerAddress", "127.0.0.1:9922")
|
|
|
+ options.add_argument("--user-agent=" +user_agent)
|
|
|
options.add_argument("--incognito")
|
|
|
|
|
|
driver = webdriver.Chrome(
|
|
@@ -103,7 +106,7 @@ def run_once(q):
|
|
|
class JParams(object):
|
|
|
|
|
|
def get(self, kw,domain):
|
|
|
- print(kw)
|
|
|
+ print('kw')
|
|
|
print(domain)
|
|
|
run_once( (kw,domain) )
|
|
|
|