123456789101112131415161718192021 |
- import gsearch_general
- import sys
- import dataset
- import datetime
- db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
- table=db['fb_gsearch']
- driver=gsearch_general.restart_browser()
- idx=gsearch_general.process_query(driver,'site:facebook.com pages 道路救援',number_results=100,language_code='zh-TW')
- print(idx)
- for x in idx:
- x['dt']=datetime.datetime.now()
- table.insert(x)
- if idx==None:
- print(driver.page_source)
- if '我們的系統偵測到您的電腦網路送出的流量有異常情況' in driver.page_source:
- print('baned.....')
- sys.exit()
|