1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #!/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...")
- fw.write("function forum(){ \n")
- fw.write("var r8= document.getElementById('row_choz8'); \n")
- fw.write("var r9 = document.getElementById('row_choz9'); \n")
- fw.write(' r8.style.display="none"; \n')
- fw.write(' r9.style.display = "block"; \n')
- fw.write("} \n")
- #
- # 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",curdir+"/index.html")
- break
- #for l in lst:
- # os.chdir(curdir)
- # os.system('curl https://hhh.com.tw/columns/detail/'+l+'/ > index.html')
|