12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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
- def run_once():
- db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
- lst = []
-
- cursor = db.query('select term, domain from seo.selected_kw where client not in ("毛怪","hhh")')
- for c in cursor:
- lst.append([c['term'], c['domain']])
- #lst2=[['台灣仁本生命服務團隊','sctt.com.tw']]
- obj = random.choice(lst)
- kw = obj[0]
- domain = obj[1]
- print(kw, domain)
- db.close()
-
- intval = os.system(f'python3 general_clickbot_proxy.py get --kw="{kw}" --domain="{domain}"')
-
- print('執行完成genetal_clickbot')
-
- if intval == -1:
- print('-1')
- sys.exit()
- def run_specific():
- db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
- lst = []
-
- cursor = db.query('select term, domain from seo.selected_kw where client="神助物流"')
- for c in cursor:
- lst.append([c['term'], c['domain']])
- db.close()
- obj = random.choice(lst)
- print('隨機',obj)
- #obj = ['貨架','gs-rack.com']
- if obj[0]=='重型 架':
- lst_1 = ['重型架 無軌式重型移動','重型架 無軌移動貨架','重型 架 神助物流']
- kw = random.choice(lst_1)
- elif obj[0]=='貨架':
- lst_2=['貨架 無軌式重型移動','貨架 無軌式重型移動貨架','貨架 無軌移動貨架儲存方案']
- kw = random.choice(lst_2)
- #elif obj[0]=='倉儲 設備':
- # kw = '倉儲 設備'
- # print(kw)
- else:
- lst_3=[]
- lst_3.append(obj[0]+' 神助物流')
- lst_3.append(obj[0])
- kw = random.choice(lst_3)
- domain = obj[1]
- print('執行的關鍵字',kw,domain)
- intval = os.system(f'python3 general_clickbot_proxy.py get --kw="{kw}" --domain="{domain}"')
- print('執行完成神助genetal_clickbot')
- if intval == -1:
- print('-1')
- sys.exit()
- while True:
- run_once()
- time.sleep(random.randint(180,200))
- run_specific()
- time.sleep(random.randint(180,200))
|