|
@@ -16,12 +16,16 @@ import time
|
|
|
import traceback
|
|
|
import sys
|
|
|
import random
|
|
|
-
|
|
|
+import requests
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
|
table=db['general_log']
|
|
|
|
|
|
|
|
|
driver = None
|
|
|
+headers = {
|
|
|
+ "Authorization": "Bearer " + "6SDULL1Ebklduc6TFxa97AFto5Sj21kyJ30CxiLiSoi",
|
|
|
+ "Content-Type": "application/x-www-form-urlencoded"
|
|
|
+}
|
|
|
|
|
|
|
|
|
def rua():
|
|
@@ -37,6 +41,14 @@ def rua():
|
|
|
return random.choice(pool)
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+def send_msg(kw):
|
|
|
+ params = {"message": "msg: "+kw}
|
|
|
+ r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
def empty_query(q):
|
|
|
global driver
|
|
|
googleurl='https://www.google.com/search?q='+urllib.parse.quote(q)
|
|
@@ -64,6 +76,8 @@ def process_query(qs):
|
|
|
idx=1
|
|
|
ranking=-1
|
|
|
print('搜尋結果數量',len(elmts))
|
|
|
+ if len(elmts) <=0:
|
|
|
+ send_msg('network failed...')
|
|
|
# driver.save_screenshot('c:/tmp/test.png')
|
|
|
|
|
|
for elmt in elmts:
|