12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/usr/bin/python3
- import os
- import codecs
- import dataset
- def proc_file(fname,fname2):
- fr=codecs.open(fname,'r','utf-8')
- fw=codecs.open(fname2,'w','utf-8')
- lines=fr.readlines()
- for l in lines:
- fw.write(l)
- if '</script>' in l:
- fw.write("\n")
- fw.write("jared...")
- print(lines)
- fr.close()
- fw.close()
- db = dataset.connect('mysql://hhh7796hhh:lYmWsu^ujcA1@hhh-v57-cluster.cluster-cmab1ctkglka.ap-northeast-2.rds.amazonaws.com:3306/xoops?charset=utf8mb4')
- dir_prefix='/var/www/jared-six/'
- cursor=db.query('SELECT hdesigner_id FROM xoops._hdesigner where onoff=1; ')
- for c in cursor:
- did=c['hdesigner_id']
- print(did)
- curdir=dir_prefix+str(did)
- if not os.path.exists(curdir):
- os.mkdir(curdir)
- os.chdir(curdir)
- os.system('curl https://hhh.com.tw/designers/cases/'+str(did)+'/1-page/new-sort/ -o orig.html')
- proc_file(curdir+"/orig.html")
- break
- #for l in lst:
- # os.chdir(curdir)
- # os.system('curl https://hhh.com.tw/columns/detail/'+l+'/ > index.html')
|