| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | import  googlesearchimport codecsimport sysimport timeimport datasetimport osimport datetimedb = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')table=db['hhh_contentgap_serp']#print(os.path.realpath('.'))curdir=os.path.realpath('.')#fr=codecs.open(curdir+os.sep+'contentgap.txt','r','utf-8')fr=codecs.open(curdir+os.sep+'hhh\\seo\\contentgap.txt','r','utf-8')lines=fr.readlines()lst=[]for l in lines:    lst.append(l.replace('\n',''))for l in lst:#for l in lst[25:]:#for l in lst[26:]:    time.sleep(5)##    results=googlesearch.search(l, num_results=150,proxy="https://109.173.102.90:8000/")    results=googlesearch.search(l, num_results=150,proxy="https://217.147.1.166:40998/")#    results=googlesearch.search(l, num_results=150)    idx=0    for r in results:        print(idx)        print(r)        if 'hhh.com.tw' in r:            print('found')            print(idx)            table.insert({'kw':l,'ranking':idx,'dt':datetime.datetime.now()})            db.commit()            break        idx+=1        sys.exit()
 |