Jason пре 1 година
родитељ
комит
7a587ff683

+ 3 - 3
website_clickjobs/gen_seo.py

@@ -198,9 +198,9 @@ def run_once(jsobj):
     # sys.exit()
 
 while True:
-    try:
-        db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
-        cursor=db.query('select json from seo.seo_jobs where cust="啟翔" and plan="形象SEO" and json like "%陳百欽%" order by rand() limit 1')
+    try:# OLD TABLE NAME: seo.seo_jobs
+        db = dataset.connect('postgresql://postgres:eyJhbGciOiJI@172.105.241.163:5432/postgres')
+        cursor=db.query("select json from public.seo_jobs_temp where cust='啟翔' and plan='形象SEO' and json like '%陳百欽%' order by random() limit 1")
         for c in cursor:
             js=json.loads(c['json'])
             prefix=js['prefix']

+ 3 - 3
website_clickjobs/gen_seo2.py

@@ -213,9 +213,9 @@ def run_once(jsobj):
     # sys.exit()
 
 while True:
-    try:
-        db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
-        cursor=db.query('select json from seo.seo_jobs where cust="啟翔" and plan="形象SEO" and json like "%陳百欽%" and (json like "%chinatimes.com%" or "%chinabiz.org.tw%" or json like "%vocus.cc%" or json like "%tw.news.yahoo.com%" or json like "%facebook.com%" or json like "%gvm.com.tw%" or json like "%fingermedia.tw%" or json like "%bg3.co%" or json like "%morningtaiwan.org%" or json like "%pchome.com.tw%" or json like "%twfile.com%" or json like "%twincn.com%" or json like "%theicons.net%" or json like "%nhu.edu.tw%" or json like "%nobad.news%" or json like "%googo.org%" or json like "%aimedia.cc%") order by rand() limit 1')
+    try:# OLD TABLE NAME: seo.seo_jobs
+        db = dataset.connect('postgresql://postgres:eyJhbGciOiJI@172.105.241.163:5432/postgres')
+        cursor=db.query("select json from public.seo_jobs_temp where cust='啟翔' and plan='形象SEO' and json like '%陳百欽%' and (json like '%chinatimes.com%' or json like '%chinabiz.org.tw%' or json like '%vocus.cc%' or json like '%tw.news.yahoo.com%' or json like '%facebook.com%' or json like '%gvm.com.tw%' or json like '%fingermedia.tw%' or json like '%bg3.co%' or json like '%morningtaiwan.org%' or json like '%pchome.com.tw%' or json like '%twfile.com%' or json like '%twincn.com%' or json like '%theicons.net%' or json like '%nhu.edu.tw%' or json like '%nobad.news%' or json like '%googo.org%' or json like '%aimedia.cc%') order by random() limit 1")
         for c in cursor:
             js=json.loads(c['json'])
             prefix=js['prefix']

+ 3 - 3
website_clickjobs/gen_seo2a.py

@@ -221,9 +221,9 @@ def run_once(jsobj,db):
     # sys.exit()
 
 def exe():
-    try:
-        db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
-        cursor=db.query('select json from seo.seo_jobs where cust="啟翔" and plan="形象SEO" and json like "%陳百欽%" and (json like "%chinatimes.com%") order by rand() limit 1')
+    try: # OLD TABLE NAME: seo.seo_jobs
+        db = dataset.connect('postgresql://postgres:eyJhbGciOiJI@172.105.241.163:5432/postgres')
+        cursor=db.query("select json from public.seo_jobs_temp where cust='啟翔' and plan='形象SEO' and json like '%陳百欽%' and (json like '%chinatimes.com%') order by random() limit 1")
         for c in cursor:
             js=json.loads(c['json'])
             prefix=js['prefix']

+ 4 - 3
website_clickjobs/type-V/_execute.py

@@ -17,7 +17,8 @@ import json
 
 driver=None
 
-db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
+db = dataset.connect('postgresql://postgres:eyJhbGciOiJI@172.105.241.163:5432/postgres')
+
 table=db['nda_log']
 path = 'C:/ChromeDriver' #pls adjust
 path_z = 'C:/ChromeDriver' #pls adjust
@@ -35,8 +36,8 @@ def restart_browser():
 
 resultdict={'搜尋詞':[],'網域':[],'結果標題':[],'結果網址':[],'結果名次':[]}
 
-def pickterm(client):
-    ds=db.query('select json from seo.seo_jobs where cust="' + client + '" order by rand() limit 1')
+def pickterm(client): # OLD TABLE NAME: seo.seo_jobs
+    ds=db.query("select json from public.seo_jobs_temp where cust='" + client + "' order by random() limit 1")
     #TAG ABOVE AND UNTAG BELOW FOR DEBUG
     #ds=hhhdb.query('select * from seo.seo_articles where cust=')