|
@@ -0,0 +1,70 @@
|
|
|
+import sys
|
|
|
+import codecs
|
|
|
+import traceback
|
|
|
+import requests
|
|
|
+import re
|
|
|
+import pandas as pd
|
|
|
+import random
|
|
|
+import urllib
|
|
|
+import json
|
|
|
+import gspread
|
|
|
+import datetime
|
|
|
+from gspread_pandas import Spread, Client
|
|
|
+from oauth2client.service_account import ServiceAccountCredentials
|
|
|
+import os
|
|
|
+import redis
|
|
|
+import time
|
|
|
+import fire
|
|
|
+import dataset
|
|
|
+import pymysql
|
|
|
+pymysql.install_as_MySQLdb()
|
|
|
+
|
|
|
+def run_once(pport, dockername):
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
|
|
|
+ lst = []
|
|
|
+
|
|
|
+ cursor = db.query('SELECT * FROM hhh.seo_designer')
|
|
|
+ for c in cursor:
|
|
|
+
|
|
|
+ lst.append([c['kw']])
|
|
|
+
|
|
|
+ obj = random.choice(lst)
|
|
|
+ print(obj)
|
|
|
+ kw = obj[0]
|
|
|
+ domain = 'hhh.com.tw'
|
|
|
+ print(kw,domain)
|
|
|
+
|
|
|
+ s = f'python3 general_clickbot.py get --kw="{kw}" --domain="{domain}" --port={str(pport)}'
|
|
|
+
|
|
|
+ intval = os.system(f'python3 general_clickbot.py get --kw="{kw}" --domain="{domain}" --port="{str(pport)}"')
|
|
|
+
|
|
|
+ print('執行genetal_clickbot')
|
|
|
+
|
|
|
+ if intval == -1:
|
|
|
+ print('-1')
|
|
|
+ sys.exit()
|
|
|
+
|
|
|
+
|
|
|
+class JParams(object):
|
|
|
+
|
|
|
+ def get(self, port=9222):
|
|
|
+ while True:
|
|
|
+ try:
|
|
|
+ os.system('docker container restart tiny4')
|
|
|
+ os.system('docker container restart tiny5')
|
|
|
+ os.system('docker container restart tiny6')
|
|
|
+ time.sleep(1)
|
|
|
+ run_once(9925, 'tiny4')
|
|
|
+ run_once(9926, 'tiny5')
|
|
|
+ run_once(9927, 'tiny6')
|
|
|
+
|
|
|
+ time.sleep(20)
|
|
|
+
|
|
|
+ except:
|
|
|
+ os.system('docker container restart tiny4')
|
|
|
+ time.sleep(15)
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ fire.Fire(JParams)
|
|
|
+
|