|
@@ -23,9 +23,12 @@ import time
|
|
|
import requests
|
|
|
from time import sleep
|
|
|
#from wrapt_timeout_decorator import *
|
|
|
+import pymysql
|
|
|
+pymysql.install_as_MySQLdb()
|
|
|
+
|
|
|
driver=None
|
|
|
|
|
|
-db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
|
+# db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
|
|
|
|
headers = {
|
|
|
"Authorization": "Bearer " + "6SDULL1Ebklduc6TFxa97AFto5Sj21kyJ30CxiLiSoi",
|
|
@@ -34,7 +37,7 @@ headers = {
|
|
|
|
|
|
def send_msg(kw):
|
|
|
params = {"message":kw}
|
|
|
- r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
+ # r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
|
|
|
|
|
|
|
|
@@ -54,7 +57,7 @@ def re_get_webdriver():
|
|
|
options = webdriver.ChromeOptions()
|
|
|
options.add_argument("--no-sandbox")
|
|
|
options.add_argument("--disable-dev-shm-usage")
|
|
|
-# options.add_argument("--headless")
|
|
|
+ # options.add_argument("--headless")
|
|
|
# options.add_argument('--proxy-server='+proxy)
|
|
|
# options.add_argument('--proxy-server=socks5://172.104.93.163:41800')
|
|
|
|
|
@@ -70,7 +73,8 @@ def re_get_webdriver():
|
|
|
if os.name=='nt':
|
|
|
driver = webdriver.Chrome(executable_path='C:/portable/webdriver/chrome102/chromedriver.exe',options=options)
|
|
|
else:
|
|
|
- driver = webdriver.Chrome(options=options)
|
|
|
+ # driver = webdriver.Chrome(options=options)
|
|
|
+ driver = webdriver.Chrome(options=options,executable_path='/Users/zooeytsai/Downloads/chromedriver 4')
|
|
|
except:
|
|
|
traceback.print_exc()
|
|
|
|
|
@@ -88,7 +92,7 @@ def re_get_webdriver():
|
|
|
|
|
|
def run_once(jsobj):
|
|
|
|
|
|
- table=db['rank_detection']
|
|
|
+ # table=db['rank_detection']
|
|
|
print(jsobj)
|
|
|
global driver
|
|
|
kw=jsobj['kw']
|
|
@@ -129,8 +133,8 @@ time.sleep(8)
|
|
|
#os.system('curl --socks5 choozmo:choozmo9@172.104.93.163:41800 http://www.google.com')
|
|
|
time.sleep(3)
|
|
|
|
|
|
-r=random.randint(0,1)
|
|
|
-r=2
|
|
|
+# r=random.randint(0,1)
|
|
|
+r=1
|
|
|
if r==0:
|
|
|
prefix="site:hhh.com.tw "
|
|
|
domain=['hhh.com.tw']
|
|
@@ -147,6 +151,6 @@ elif r==2:
|
|
|
|
|
|
|
|
|
kw=random.choice(positive)
|
|
|
-run_once({'domain':domain,'kw':prefix+kw+postfix})
|
|
|
+run_once({'domain':domain,'kw':kw+prefix})
|
|
|
|
|
|
|