run_sheet.py 996 B

1234567891011121314151617181920212223242526272829303132333435
  1. import sys
  2. import codecs
  3. import traceback
  4. import requests
  5. import re
  6. import pandas as pd
  7. import random
  8. import urllib
  9. import json
  10. import os
  11. import redis
  12. import time
  13. r = redis.Redis(host='db.ptt.cx', port=6379, db=1,password='choozmo9')
  14. js=r.get('innews_sheet')
  15. jsobj=json.loads(js)
  16. while True:
  17. kw=random.choice(jsobj) # 第一次(三組關鍵字)
  18. kw_innews = '引新聞 ' # 第二次(隨機選擇兩組關鍵字與引新聞)
  19. num = random.choices([0,1,2],k=2)
  20. for i in num:
  21. kw_innews+=kw['kw'].split(' ')[i]+' '
  22. print(kw)
  23. # os.chdir('/Users/zooeytsai/kw_tools/INNNews')
  24. print('python3 general_clickbot.py get --kw="'+kw['kw']+'" --domain=innews.com.tw')
  25. os.system('python general_clickbot_local.py get --kw="'+kw['kw']+'" --domain=innews.com.tw')
  26. print('等待')
  27. time.sleep(120)
  28. # time.sleep(120)
  29. # os.system('python3 general_clickbot.py get --kw="'+kw_innews+'" --domain=innews.com.tw')
  30. # os.system('python notifytest.py send_msg')