designer_gen.py 719 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/python3
  2. import os
  3. import codecs
  4. import dataset
  5. db = dataset.connect('mysql://hhh7796hhh:lYmWsu^ujcA1@hhh-v57-cluster.cluster-cmab1ctkglka.ap-northeast-2.rds.amazonaws.com:3306/xoops?charset=utf8mb4')
  6. dir_prefix='/var/www/jared-six/'
  7. cursor=db.query('SELECT hdesigner_id FROM xoops._hdesigner where onoff=1; ')
  8. for c in cursor:
  9. did=c['hdesigner_id']
  10. print(did)
  11. curdir=dir_prefix+str(did)
  12. if not os.path.exists(curdir):
  13. os.mkdir(curdir)
  14. os.chdir(curdir)
  15. os.system('curl https://hhh.com.tw/designers/cases/'+did+'/1-page/new-sort/ -o index.html')
  16. break
  17. #for l in lst:
  18. # os.chdir(curdir)
  19. # os.system('curl https://hhh.com.tw/columns/detail/'+l+'/ > index.html')