def bank_fjcf_page_url( page: int = 5, item: str = "分局本级", begin: int = 1 ) -> pd.DataFrame: """ 获取 首页-政务信息-行政处罚-银保监分局本级-每一页的 json 数据 :param page: 需要获取前 page 页的内容, 总页数请通过 bank_fjcf_total_page() 获取 :type page: int :return: 需要的字段 :rtype: pandas.DataFrame """ cbirc_headers = cbirc_headers_without_cookie_2020.copy() main_url = "http://www.cbirc.gov.cn/cbircweb/DocInfo/SelectDocByItemIdAndChild" temp_df = pd.DataFrame() for i_page in range(begin, page + begin): print(i_page) params = { "itemId": item_id_list[item], "pageSize": "18", "pageIndex": str(i_page), } res = requests.get(main_url, params=params, headers=cbirc_headers) temp_df = temp_df.append(pd.DataFrame(res.json()["data"]["rows"])) return temp_df[ ["docId", "docSubtitle", "publishDate", "docFileUrl", "docTitle", "generaltype"] ]
def bank_fjcf_total_num(item: str = "分局本级") -> int: """ 首页-政务信息-行政处罚-银保监分局本级 总页数 http://www.cbirc.gov.cn/cn/view/pages/ItemList.html?itemPId=923&itemId=4115&itemUrl=ItemListRightList.html&itemName=%E9%93%B6%E4%BF%9D%E7%9B%91%E5%88%86%E5%B1%80%E6%9C%AC%E7%BA%A7&itemsubPId=931 :return: 总页数 :rtype: int """ cbirc_headers = cbirc_headers_without_cookie_2020.copy() main_url = "http://www.cbirc.gov.cn/cbircweb/DocInfo/SelectDocByItemIdAndChild" params = { "itemId": item_id_list[item], "pageSize": "18", "pageIndex": "1", } res = requests.get(main_url, params=params, headers=cbirc_headers) return int(res.json()["data"]["total"])