|
@@ -17,7 +17,6 @@ import traceback
|
|
|
import sys
|
|
|
from selenium.webdriver.common.keys import Keys
|
|
|
import timeit
|
|
|
-import socket
|
|
|
|
|
|
add_tabs = [7,9,11,13,15,7,9,11,13,15,7,9,11,13,15,7,9,11,13,15]
|
|
|
|
|
@@ -34,9 +33,6 @@ def send_msg(kw):
|
|
|
params = {"message": "處理關鍵字: "+kw}
|
|
|
r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
|
|
|
-def notify(msg):
|
|
|
- params = {"message": "處理關鍵字: "+kw}
|
|
|
- r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
|
|
|
def empty_query(q):
|
|
|
global driver
|
|
@@ -48,22 +44,18 @@ def process_query(domain, target_domain, brands, query):
|
|
|
print(query)
|
|
|
sleepoffset = 0
|
|
|
global driver
|
|
|
- if query == "艾立思":
|
|
|
- driver.get('https://www.google.com/search?num=100&q=艾立思&rlz=1C1ONGR_zh-TWTW997TW997&ei=zjdUY_DBG9Lm-Abpgq84&start=0&sa=N&filter=0&ved=2ahUKEwjw4KeEvfT6AhVSM94KHWnBCwcQ8tMDegQIARAQ&cshid=1666463754367857&biw=1368&bih=761&dpr=2')
|
|
|
- time.sleep(4)
|
|
|
- else:
|
|
|
- driver.get('https://www.google.com?num=100')
|
|
|
- time.sleep(3)
|
|
|
- print(driver.current_url)
|
|
|
-
|
|
|
- # elmts=driver.find_elements_by_xpath("//div[@class='yuRUbf']/a")
|
|
|
- # ABOVE METHOD IS DEPRECATED STARTING SELENIUM 4.3.0, USE THIS
|
|
|
- #
|
|
|
- elmt = driver.find_element(By.XPATH, "//input[@name='q']")
|
|
|
- time.sleep(1)
|
|
|
-
|
|
|
- elmt.send_keys(query)
|
|
|
- elmt.send_keys(Keys.ENTER)
|
|
|
+ driver.get('https://www.google.com?num=100')
|
|
|
+ time.sleep(3)
|
|
|
+ print(driver.current_url)
|
|
|
+
|
|
|
+ # elmts=driver.find_elements_by_xpath("//div[@class='yuRUbf']/a")
|
|
|
+ # ABOVE METHOD IS DEPRECATED STARTING SELENIUM 4.3.0, USE THIS
|
|
|
+ #
|
|
|
+ elmt = driver.find_element(By.XPATH, "//input[@name='q']")
|
|
|
+ time.sleep(1)
|
|
|
+
|
|
|
+ elmt.send_keys(query)
|
|
|
+ elmt.send_keys(Keys.ENTER)
|
|
|
|
|
|
idx=1
|
|
|
ranking=-1
|
|
@@ -90,11 +82,6 @@ def process_query(domain, target_domain, brands, query):
|
|
|
print('clicked....')
|
|
|
print(href)
|
|
|
print(txt)
|
|
|
-
|
|
|
- if query == "艾立思" and href != "https://hhh.com.tw/brand-index.php?brand_id=211":
|
|
|
- print("wrong site")
|
|
|
- continue
|
|
|
-
|
|
|
webdriver.ActionChains(driver).move_to_element(el).perform()
|
|
|
webdriver.ActionChains(driver).move_to_element(el).click().perform()
|
|
|
time.sleep(15)
|
|
@@ -168,8 +155,6 @@ def execute(domain, target_domain, brands, query_list):
|
|
|
print("Process returned with " + str(statuscode))
|
|
|
if statuscode == 444:
|
|
|
print("You have been caught!!! Program terminating.")
|
|
|
-
|
|
|
- #notify("Clickbot " + brands[domain] + " has been caught by Google and will terminate. IP: ")
|
|
|
return statuscode
|
|
|
|
|
|
extrasleep = 0
|