Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def bank_page_list(page=5):
"""
想要获取多少页的内容
注意路径
http://www.cbirc.gov.cn/cn/list/9103/910305/ybjfjcf/1.html
:param page: int 输入从第 1 页到 all_page 页的内容
:return: pd.DataFrame 另存为 csv 文件
"""
big_url_list = []
big_title_list = []
flag = True
cbirc_headers = cbirc_headers_without_cookie_2019.copy()
for i_page in range(1, page):
# i_page = 1
print(i_page)
main_url = "http://www.cbirc.gov.cn/cn/list/9103/910305/ybjfjcf/{}.html".format(
i_page
)
if flag:
res = requests.get(main_url, headers=cbirc_headers)
temp_cookie = res.headers["Set-Cookie"].split(";")[0]
cbirc_headers.update({"Cookie": res.headers["Set-Cookie"].split(";")[0]})
res = requests.get(main_url, headers=cbirc_headers)
soup = BeautifulSoup(res.text, "lxml")
res_html = (
"function getClearance(){"
+ soup.find_all("script")[0].get_text()
+ "};"