gen_clickjob.py 729 B

12345678910111213141516171819
  1. import time
  2. import json
  3. import random
  4. import dataset
  5. #r = redis.Redis(host='db.ptt.cx', port=6379, db=1)
  6. #p = r.pubsub(ignore_subscribe_messages=True)
  7. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
  8. table=db['seo_clickjobs']
  9. #cursor=db.query('select id,kw from gtrends where name = "'+site+'" order by rand() limit 1')
  10. category='hhh-faq'
  11. qlist=[('預售屋客變教學',0,'hhh.com.tw'),('預售屋客變',0,'hhh.com.tw'),('預售屋客變流程',0,'hhh.com.tw'),('預售屋客變省錢',0,'hhh.com.tw'),('所有的地方都能進行客變嗎',0,'hhh.com.tw'),('什麼是客變',0,'hhh.com.tw')]
  12. for q in qlist:
  13. table.insert({'kw':q[0],'page':q[1],'domain':q[2],'category':category})