|
@@ -28,6 +28,7 @@ import traceback
|
|
|
import time
|
|
|
from selenium.webdriver.common.keys import Keys
|
|
|
from selenium.webdriver.common.by import By
|
|
|
+from selenium.webdriver.chrome.service import Service
|
|
|
# import pymysql
|
|
|
# pymysql.install_as_MySQLdb()
|
|
|
|
|
@@ -50,7 +51,7 @@ app.add_middleware(
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/gtrends?charset=utf8mb4')
|
|
|
|
|
|
# app.mount("/web", StaticFiles(directory="static"), name="static")
|
|
|
-app.mount("/web", StaticFiles(directory="/Users/zooeytsai/kw_tools/web/static"), name="static")
|
|
|
+app.mount("/web", StaticFiles(directory="/root/src/kw_tools/web/static"), name="static")
|
|
|
|
|
|
def thread_function(kw):
|
|
|
global db
|
|
@@ -135,7 +136,8 @@ async def ranking(kw: str = Form(...), domain:str = Form(...)):
|
|
|
options.add_argument("--no-sandbox")
|
|
|
options.add_argument("--disable-dev-shm-usage")
|
|
|
options.add_argument('--headless')
|
|
|
- driver = webdriver.Chrome(options=options)
|
|
|
+ s = Service('/root/drivers/102/chromedriver')
|
|
|
+ driver = webdriver.Chrome(options=options,service=s)
|
|
|
driver.set_window_size(950, 20000)
|
|
|
|
|
|
# db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
@@ -185,4 +187,4 @@ async def tree_list():
|
|
|
|
|
|
# html += "<tr><td>" + c['kw'] + "</td>"
|
|
|
|
|
|
- return html
|
|
|
+ return html
|