|
@@ -15,23 +15,26 @@ from bs4 import BeautifulSoup
|
|
import requests
|
|
import requests
|
|
import dataset
|
|
import dataset
|
|
import time
|
|
import time
|
|
-import rpyc
|
|
|
|
import sys
|
|
import sys
|
|
import docker
|
|
import docker
|
|
-# import pymysql
|
|
|
|
-# pymysql.install_as_MySQLdb()
|
|
|
|
-from ga_click import main
|
|
|
|
|
|
+import pymysql
|
|
|
|
+pymysql.install_as_MySQLdb()
|
|
|
|
+# from ga_click import main
|
|
|
|
|
|
headers = {
|
|
headers = {
|
|
"Authorization": "Bearer " + "OZDcq7sVKwr3F6YNLtBF3LuIgpa4Ql9eAnBWeD7sHTJ",
|
|
"Authorization": "Bearer " + "OZDcq7sVKwr3F6YNLtBF3LuIgpa4Ql9eAnBWeD7sHTJ",
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+name = {'taroboba-yuan.com': '清原', 'hhh.com.tw': ['幸福空間', '幸福空間設計師'], 'sctt.com.tw': '仁本',
|
|
|
|
+ 'gs-rack.com': '神助物流', 'gs-rack.com/tag': '神助物流', 'bennis.com.tw': '班尼斯', 'yogoclean.com': '有夠讚',
|
|
|
|
+ 'yesonlineeng.com': '新飛'}
|
|
|
|
+
|
|
|
|
|
|
def send_msg(kw):
|
|
def send_msg(kw):
|
|
params = {"message": kw}
|
|
params = {"message": kw}
|
|
# print('通知結果', params)
|
|
# print('通知結果', params)
|
|
- r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
|
|
|
+ # r = requests.post("https://notify-api.line.me/api/notify", headers=headers, params=params)
|
|
|
|
|
|
|
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
@@ -42,14 +45,16 @@ cursor_sns = db.query(
|
|
'SELECT * FROM seo.sns_log where datediff(now(),dt)=0 order by dt desc')
|
|
'SELECT * FROM seo.sns_log where datediff(now(),dt)=0 order by dt desc')
|
|
result = "\n"
|
|
result = "\n"
|
|
idx = 0
|
|
idx = 0
|
|
-d = {'taroboba-yuan.com':0,'yogoclean.com':0,'yesonlineeng.com':0,'lehua.com.tw':0,'sogoodday.com.tw':0,
|
|
|
|
-'howday.com.tw':0,'vickybrain.com':0,'crclinic072.com':0,'planta.com.tw':0,'misaglobal.org':0}
|
|
|
|
|
|
+d = {'yogoclean.com': 0, 'sogoodday.com.tw': 0, 'vickybrain.com': 0, 'crclinic072.com': 0, 'planta.com.tw': 0,
|
|
|
|
+ 'misaglobal.org': 0,
|
|
|
|
+ 'kuchichun.com': 0, 'reformbio.asia': 0, 'www.heartwealthy.com': 0, 'cliqproducts.com.tw': 0,'www.hujiai-international.com':0,
|
|
|
|
+ 'lisinbeauty.com':0,'simpleprotein.tw':0,'taroboba-yuan.com':0,'kolin.com.tw':0,'yesonlineeng.com':0}
|
|
for c in cursor:
|
|
for c in cursor:
|
|
custom_name = c['domain']
|
|
custom_name = c['domain']
|
|
if custom_name in d:
|
|
if custom_name in d:
|
|
- if custom_name == 'hhh.com.tw' and c['num']==1:
|
|
|
|
- d['hhh.com.tw/designer']+=1
|
|
|
|
- d[custom_name]+=1
|
|
|
|
|
|
+ if custom_name == 'hhh.com.tw' and c['num'] == 1:
|
|
|
|
+ d['hhh.com.tw/designer'] += 1
|
|
|
|
+ d[custom_name] += 1
|
|
idx += 1
|
|
idx += 1
|
|
if idx <= 3:
|
|
if idx <= 3:
|
|
elmt = c['kw']
|
|
elmt = c['kw']
|
|
@@ -58,31 +63,30 @@ for c in cursor:
|
|
custom_name = name[domain]
|
|
custom_name = name[domain]
|
|
except:
|
|
except:
|
|
pass
|
|
pass
|
|
- result += "[" + str(c['ranking']) + "]:" + elmt + " "+ f"({custom_name})\n"
|
|
|
|
|
|
+ result += "[" + str(c['ranking']) + "]:" + elmt + " " + f"({custom_name})\n"
|
|
sns_result = ""
|
|
sns_result = ""
|
|
-sns_d = {'班尼斯':0}
|
|
|
|
|
|
+sns_d = {'班尼斯': 0}
|
|
for c in cursor_sns:
|
|
for c in cursor_sns:
|
|
elmt = c['kw']
|
|
elmt = c['kw']
|
|
title = c['title']
|
|
title = c['title']
|
|
custom_name = c['client']
|
|
custom_name = c['client']
|
|
if custom_name in sns_d:
|
|
if custom_name in sns_d:
|
|
- sns_d[custom_name]+=1
|
|
|
|
|
|
+ sns_d[custom_name] += 1
|
|
sns_result = f"\n[{c['ranking']}] {elmt} {title}"
|
|
sns_result = f"\n[{c['ranking']}] {elmt} {title}"
|
|
-
|
|
|
|
-per_total_click =f"清原:{d['taroboba-yuan.com']}\n新飛:{d['yesonlineeng.com']}\n有夠讚:{d['yogoclean.com']}\n樂樺:{d['lehua.com.tw']}\n好晴天:{d['sogoodday.com.tw']}\n好日子:{d['howday.com.tw']}\n薇懠:{d['vickybrain.com']}\n宏康:{d['crclinic072.com']}\nplantA:{d['planta.com.tw']}\nmisa:{d['misaglobal.org']}\n"
|
|
|
|
|
|
+
|
|
|
|
+per_total_click = f"有夠讚:{d['yogoclean.com']}\n好晴天:{d['sogoodday.com.tw']}\n薇懠:{d['vickybrain.com']}\n宏康:{d['crclinic072.com']}\nplantA:{d['planta.com.tw']}\nmisa:{d['misaglobal.org']}\n辜琦鈞:{d['kuchichun.com']}\n瑞福:{d['reformbio.asia']}\n鑫富:{d['www.heartwealthy.com']}\nCLIQ露營椅:{d['cliqproducts.com.tw']}\n護全:{d['www.hujiai-international.com']}\n美麗馨:{d['lisinbeauty.com']}\n極簡乳清:{d['simpleprotein.tw']}\n清原:{d['taroboba-yuan.com']}\n歌林:{d['kolin.com.tw']}\n新飛:{d['yesonlineeng.com']}\n"
|
|
sns_per_total_click = f"\n"
|
|
sns_per_total_click = f"\n"
|
|
print(per_total_click)
|
|
print(per_total_click)
|
|
print(sns_per_total_click)
|
|
print(sns_per_total_click)
|
|
# print(sns_result)
|
|
# print(sns_result)
|
|
msg_per_total_click = '\n點擊次數總計:\n' + per_total_click
|
|
msg_per_total_click = '\n點擊次數總計:\n' + per_total_click
|
|
msg = "\n機器人執行次數:" + str(idx)
|
|
msg = "\n機器人執行次數:" + str(idx)
|
|
-ga_sessions = '\n幸福空間的GA Sessions'+main()['ga:sessions']
|
|
|
|
|
|
+# ga_sessions = '\n幸福空間的GA Sessions' + main()['ga:sessions']
|
|
sns_per_total_click = '\n點擊次數總計:\n' + sns_per_total_click
|
|
sns_per_total_click = '\n點擊次數總計:\n' + sns_per_total_click
|
|
# print(msg_per_total_click + result + sns_per_total_click + sns_result + ga_sessions)
|
|
# print(msg_per_total_click + result + sns_per_total_click + sns_result + ga_sessions)
|
|
-send_msg(msg_per_total_click + result + sns_per_total_click + sns_result + ga_sessions)
|
|
|
|
|
|
+send_msg(msg_per_total_click + result + sns_per_total_click + sns_result)
|
|
db.close()
|
|
db.close()
|
|
|
|
|
|
-
|
|
|
|
# schtasks /create /sc minute /mo 30 /sd 2022/05/050 /st 9:00 /et 23:00 /tn "linebat" /tr "C:\tmp\inn_line.bat"
|
|
# schtasks /create /sc minute /mo 30 /sd 2022/05/050 /st 9:00 /et 23:00 /tn "linebat" /tr "C:\tmp\inn_line.bat"
|
|
|
|
|
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|