from web.Requests_Except import * import pandas as pd r_id_list = [30113,37407,23330,44513,36089,3456,7916] pd_data = { "resume_id": [], "姓名": [], "电话": [], } cookies = { 'auth-token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NDczNzA1ODUsImp0aSI6IjBlZDI0NTM0LWE0NjEtNDkxNC1iNDU1LWQxZGEzYzQ5N2U0NiIsIm5hbWUiOiIxODYxNzg3MjE4NSIsInVzZXJfaWQiOiIxYTJkODFjMTFkM2MzMmVhYmVlNWFkM2E3NGFmYWViNyIsInRlbmFudF90b2tlbiI6ImQzNWVjMmEzNjAxODM1NWE4MTg3ZTEyODI3MzE3ZGRjIn0.HoaWksDiMxtkbBJ8jVPlKLKzd1UqNHo4KfecS2uVUaM', 'PHPSESSID': '04cdc37cc18bb148fec8e276a6796eed', } headers = { 'accept': 'application/json, text/plain, */*', 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', 'cache-control': 'no-cache', 'content-type': 'application/json;charset=UTF-8', 'origin': 'https://www.fnrc.vip', 'pragma': 'no-cache', 'priority': 'u=1, i', 'referer': 'https://www.fnrc.vip/enterprise/resume_store/list', 'sec-ch-ua': '"Google Chrome";v="135", "Not-A.Brand";v="8", "Chromium";v="135"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36', } base_url = 'www.fnrc.vip' protocol = 'https' Request = MR(base_url, protocol) Request.set_default_cookies(cookies) Request.set_default_headers(headers) def get_resume_info(resume_id): url = '/job/company/v1/resume/loadResume' json_data = { 'resume_id': resume_id,} response = Request.post(url, json=json_data) return response.to_Dict() def get_phone_encrypt(resume_id): url = '/job/company/v1/company/getResumeUserPhone' json_data = { 'resume_id': resume_id, 'delivery_id': '', 'is_pc': 1, } response = Request.post(url, json=json_data) return response.to_Dict() def buy_resume(resume_id): url = '/job/company/v1/company/buyResumeUserPhone' json_data = { 'resume_id': resume_id, 'from_type': '', } response = Request.post(url, json=json_data) return response.to_Dict() def integrate(): for resume_id in r_id_list: resume_info = get_resume_info(resume_id) phone_encrypt = get_phone_encrypt(resume_id) if hasattr(phone_encrypt,'phone'): phone_encrypt = phone_encrypt.phone else: buy_resume_info = buy_resume(resume_id) if hasattr(buy_resume_info,'buy_success') and buy_resume_info.buy_success: phone_encrypt = get_phone_encrypt(resume_id).phone else: phone_encrypt = None pd_data['resume_id'].append(resume_id) pd_data['姓名'].append(resume_info.user_name) pd_data['电话'].append(phone_encrypt) df = pd.DataFrame(pd_data) df.to_excel('服务_Phone.xlsx', index=False) print("数据已保存到 厨师.csv") if __name__ == '__main__': integrate()