提交 857329de 作者: 薛凌堃

新三板财务数据采集维护

上级 96c1e391
...@@ -48,6 +48,18 @@ def getrequests(url): ...@@ -48,6 +48,18 @@ def getrequests(url):
return a_infoData return a_infoData
def getdriver(url_name): def getdriver(url_name):
opt = webdriver.ChromeOptions()
opt.add_argument(
'user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36')
opt.add_argument("--ignore-certificate-errors")
opt.add_argument("--ignore-ssl-errors")
opt.add_experimental_option("excludeSwitches", ["enable-automation"])
opt.add_experimental_option('excludeSwitches', ['enable-logging'])
opt.add_experimental_option('useAutomationExtension', False)
opt.binary_location = r'D:/Google/Chrome/Application/chrome.exe'
chromedriver = r'D:/cmd100/chromedriver.exe'
browser = webdriver.Chrome(chrome_options=opt, executable_path=chromedriver)
# 使用模拟浏览器打开 # 使用模拟浏览器打开
browser.get(url_name) browser.get(url_name)
time.sleep(3) time.sleep(3)
...@@ -244,18 +256,7 @@ if __name__ == '__main__': ...@@ -244,18 +256,7 @@ if __name__ == '__main__':
continue continue
list_date.append(date) list_date.append(date)
opt = webdriver.ChromeOptions()
opt.add_argument(
'user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36')
opt.add_argument("--ignore-certificate-errors")
opt.add_argument("--ignore-ssl-errors")
opt.add_experimental_option("excludeSwitches", ["enable-automation"])
opt.add_experimental_option('excludeSwitches', ['enable-logging'])
opt.add_experimental_option('useAutomationExtension', False)
opt.binary_location = r'D:/Google/Chrome/Application/chrome.exe'
chromedriver = r'D:/cmd100/chromedriver.exe'
browser = webdriver.Chrome(chrome_options=opt, executable_path=chromedriver)
headers = { headers = {
'authority': 'stock.xueqiu.com', 'authority': 'stock.xueqiu.com',
'method': 'GET', 'method': 'GET',
......
...@@ -1436,37 +1436,37 @@ if __name__ == '__main__': ...@@ -1436,37 +1436,37 @@ if __name__ == '__main__':
# except: # except:
# pass # pass
try:
log.info('dongfangcaifu3')
dongfangcaifu3()
except Exception as e:
log.info(e)
pass
# try: # try:
# log.info('dongfangcaifu4') # log.info('dongfangcaifu3')
# dongfangcaifu4() # dongfangcaifu3()
# except Exception as e: # except Exception as e:
# log.info(e) # log.info(e)
# pass # pass
# try: # try:
# log.info('dongfangcaifu5') # log.info('dongfangcaifu4')
# dongfangcaifu5() # dongfangcaifu4()
# except Exception as e: # except Exception as e:
# log.info(e) # log.info(e)
# pass # pass
# try: try:
# log.info('dongfangcaifu6') log.info('dongfangcaifu5')
# dongfangcaifu6() dongfangcaifu5()
# except Exception as e: except Exception as e:
# log.info(e) log.info(e)
# pass pass
# try: try:
# log.info('dongfangcaifu7') log.info('dongfangcaifu6')
# dongfangcaifu7() dongfangcaifu6()
# except Exception as e: except Exception as e:
# log.info(e) log.info(e)
# pass pass
try:
log.info('dongfangcaifu7')
dongfangcaifu7()
except Exception as e:
log.info(e)
pass
...@@ -14,7 +14,8 @@ from obs import ObsClient ...@@ -14,7 +14,8 @@ from obs import ObsClient
from retry import retry from retry import retry
from elasticsearch import Elasticsearch from elasticsearch import Elasticsearch
from base import BaseCore from base import BaseCore
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
baseCore = BaseCore.BaseCore() baseCore = BaseCore.BaseCore()
log = baseCore.getLogger() log = baseCore.getLogger()
baseCore = BaseCore.BaseCore() baseCore = BaseCore.BaseCore()
...@@ -144,7 +145,7 @@ def main(esMethod): ...@@ -144,7 +145,7 @@ def main(esMethod):
content = soup.text.strip() content = soup.text.strip()
esMethod.updateaunn(esMethod.index_name, str(id), content, str(soup)) esMethod.updateaunn(esMethod.index_name, str(id), content, str(soup))
return
def run_threads(num_threads,esMethod): def run_threads(num_threads,esMethod):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论