|
@@ -10,7 +10,6 @@ from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
import codecs
|
|
import codecs
|
|
import random
|
|
import random
|
|
-import requests
|
|
|
|
import dataset
|
|
import dataset
|
|
import time
|
|
import time
|
|
import traceback
|
|
import traceback
|
|
@@ -23,12 +22,6 @@ headers = {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-def send_msg(kw):
|
|
|
|
- params = {"message": "處理關鍵字: "+kw}
|
|
|
|
- r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def empty_query(q):
|
|
def empty_query(q):
|
|
global driver
|
|
global driver
|
|
googleurl='https://www.google.com/search?q='+urllib.parse.quote(q)
|
|
googleurl='https://www.google.com/search?q='+urllib.parse.quote(q)
|
|
@@ -68,12 +61,15 @@ def process_query(qs):
|
|
|
|
|
|
def run_once(q):
|
|
def run_once(q):
|
|
global driver
|
|
global driver
|
|
|
|
+ print('run_once()')
|
|
result=[]
|
|
result=[]
|
|
options = webdriver.ChromeOptions()
|
|
options = webdriver.ChromeOptions()
|
|
options.add_argument('--headless')
|
|
options.add_argument('--headless')
|
|
# options.add_argument("--user-agent=" +user_agent)
|
|
# options.add_argument("--user-agent=" +user_agent)
|
|
- options.add_argument("--incognito")
|
|
|
|
-
|
|
|
|
|
|
+# options.add_argument("--incognito")
|
|
|
|
+ options.add_argument('--no-sandbox')
|
|
|
|
+ options.add_argument("--disable-gpu")
|
|
|
|
+ options.add_argument('--disable-dev-shm-usage')
|
|
driver = webdriver.Chrome(
|
|
driver = webdriver.Chrome(
|
|
options=options)
|
|
options=options)
|
|
|
|
|
|
@@ -103,6 +99,6 @@ while True:
|
|
run_once( (c['term'],c['domain']) )
|
|
run_once( (c['term'],c['domain']) )
|
|
except:
|
|
except:
|
|
traceback.print_exc()
|
|
traceback.print_exc()
|
|
- sleepint=random.randint(380,520)
|
|
|
|
|
|
+ sleepint=random.randint(290,420)
|
|
time.sleep(sleepint)
|
|
time.sleep(sleepint)
|
|
|
|
|