routine_click.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import time
  2. import json
  3. from selenium import webdriver
  4. from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  5. import time
  6. import os
  7. import urllib.parse
  8. from selenium.webdriver.support.ui import WebDriverWait
  9. from selenium.webdriver.common.by import By
  10. from selenium.webdriver.support import expected_conditions as EC
  11. import codecs
  12. import random
  13. import requests
  14. import datetime
  15. import dataset
  16. import time
  17. import traceback
  18. import sys
  19. import fire
  20. #from INNNews import notifytest
  21. probdict={}
  22. probdict[0]={'client':'hhh','domain':'hhh.com.tw'}
  23. probdict[1]={'client':'毛怪','domain':'beastparadise.net'}
  24. probdict[2]={'client':'清原','domain':'taroboba-yuan.com'}
  25. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
  26. prob=[0,0,0,0,1,1,2,2]
  27. idx=random.choice(prob)
  28. client=probdict[idx]['client']
  29. domain=probdict[idx]['domain']
  30. term=None
  31. address="192.168.192.45:9922"
  32. cursor=db.query('SELECT term FROM seo.selected_kw where client = "'+client+'" order by rand() limit 1')
  33. for c in cursor:
  34. term=c['term']
  35. break
  36. if os.name == 'nt':
  37. py='python'
  38. else:
  39. py='python3'
  40. #set WEBDRIVER=C:/portable/webdriver/chrome98/chromedriver.exe
  41. #os.system(py+' general_remote_click.py get --kw="'+term+'" --domain='+domain+' --address="'+address+'" --epath="C:/portable/webdriver/chrome98/chromedriver.exe"')
  42. os.system(py+' general_remote_click.py get --kw="'+term+'" --domain='+domain+' --address="'+address+'"')