|
@@ -22,6 +22,13 @@ import random
|
|
|
import os
|
|
|
import time
|
|
|
import requests
|
|
|
+import platform
|
|
|
+import socket
|
|
|
+import os
|
|
|
+import time
|
|
|
+import datetime
|
|
|
+import requests
|
|
|
+
|
|
|
driver=None
|
|
|
dockername='p4444'
|
|
|
|
|
@@ -29,6 +36,10 @@ is_docker=True
|
|
|
#is_docker=False
|
|
|
db = dataset.connect('postgresql://postgres:eyJhbGciOiJI@172.105.241.163:5432/postgres')
|
|
|
|
|
|
+table=db['prog_launch']
|
|
|
+unamestr=str(platform.uname())
|
|
|
+table.insert({'uname':unamestr,'progname':os.path.basename(__file__),'dt':datetime.datetime.now()})
|
|
|
+
|
|
|
#db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
|
|
|
|
|
|
@@ -57,7 +68,8 @@ def re_get_webdriver():
|
|
|
try:
|
|
|
options = webdriver.ChromeOptions()
|
|
|
options.add_argument("--no-sandbox")
|
|
|
- options.add_argument("--headless")
|
|
|
+ if is_docker:
|
|
|
+ options.add_argument("--headless")
|
|
|
options.add_argument("--incognito")
|
|
|
# options.add_argument('--proxy-server=socks5://172.104.92.245:14900')
|
|
|
|
|
@@ -119,6 +131,8 @@ def run_once(jsobj):
|
|
|
exclude=None
|
|
|
driver.get('https://www.google.com?num=100')
|
|
|
time.sleep(1)
|
|
|
+# time.sleep(1000)
|
|
|
+
|
|
|
while True:
|
|
|
try:
|
|
|
print(driver.current_url)
|
|
@@ -133,7 +147,9 @@ def run_once(jsobj):
|
|
|
time.sleep(3)
|
|
|
|
|
|
# elmt = driver.find_element(By.XPATH, "//input[@name='q']")
|
|
|
- elmt = driver.find_element(By.XPATH, "//textarea[@type='search']")
|
|
|
+ elmt = driver.find_element(By.XPATH, "//textarea[@name='q']")
|
|
|
+
|
|
|
+# elmt = driver.find_element(By.XPATH, "//textarea[@type='search']")
|
|
|
|
|
|
time.sleep(1)
|
|
|
elmt.send_keys(kw)
|
|
@@ -229,8 +245,8 @@ def run_once(jsobj):
|
|
|
time.sleep(5)
|
|
|
|
|
|
#r=random.randint(0,7)
|
|
|
-r=987
|
|
|
-
|
|
|
+#r=6
|
|
|
+r=999
|
|
|
#JNOTE: 關鍵字點擊
|
|
|
related=''
|
|
|
|
|
@@ -249,10 +265,10 @@ if r==6:
|
|
|
plan='文章'
|
|
|
prefix=''
|
|
|
postfix=''
|
|
|
- domain=['choozmo.com']
|
|
|
+ domain=['contact_94111/%E9%99%B3%E7%99%BE%E6%AC%BD-401a08c4f3f5']
|
|
|
# positive=['集仕多']
|
|
|
# positive=['集仕多 AIGV']
|
|
|
- positive=['集仕多 三立']
|
|
|
+# positive=['集仕多 三立']
|
|
|
|
|
|
# positive=['台北室內設計公司排名']
|
|
|
# positive=[related]
|
|
@@ -262,7 +278,7 @@ if r==6:
|
|
|
# positive=['裝修屋子']
|
|
|
# positive=['']
|
|
|
# kw='幸福空間'
|
|
|
-# kw='輕裝修'
|
|
|
+ kw='陳百欽 森林資源'
|
|
|
# kw='輕裝修'
|
|
|
|
|
|
|