diff --git a/UserDefined.py b/UserDefined.py index 87bb73f..b15ed2d 100644 --- a/UserDefined.py +++ b/UserDefined.py @@ -14,9 +14,12 @@ deviceName='HUAWEI' # --------------平台选择-------------------- # 开启的平台请务必下滑找到该平台的配置项并填入对应配置 # 是否启用实习僧 -shixiseng_state = 1 -yizhanchi_state = 1 -bosszhipin_state = 1 +shixiseng_state = 0 +yizhanchi_state = 0 +bosszhipin_state = 0 +zhilianzhaopin_state = 0 +maimai_state = 0 +wubatongcheng_state = 0 # --------------实习僧配置项-------------------- # 是否投递(不投递:0,投递优先在线简历:1,投递优先离线简历:2) shixiseng_poststate = 0 @@ -30,7 +33,7 @@ shixiseng_Search = { 'nature': "", # 类型:股份制企业|合伙企业 'scale': "", # 规模:50-150人|500-2000人 'ipo': "", # 融资:B轮|A轮 - 'k': "嵌入式", # 岗位 * + 'k': "", # 岗位 * 'degree': "大专|本科", # 学历:大专|本科 'emp_chance': "", # 空间:提供转正|面议 'intention': "", # 需求:校招|实习 @@ -49,7 +52,7 @@ yizhanchi_Search = { 'minsalary': "",#最低工资 'maxsalary': "",#最高工资 'show_third_position': "", - 'keyword': "软件 ",#岗位 * + 'keyword': "",#岗位 * 'region_id': "", 'intern_time_id': "", 'intern_cycle_id': "", @@ -72,7 +75,7 @@ bosszhipin_city="" bosszhipin_Cookie ="" bosszhipin_Search = { 'scene': "1", - 'query': "嵌入式",#岗位 + 'query': "",#岗位 'city': "", 'experience': "", 'payType': "", @@ -88,4 +91,106 @@ bosszhipin_Search = { 'multiSubway': "", 'page': "1", 'pageSize': "5000" +} +# --------------智联招聘-------------------- +zhilianzhaopin_poststate = 0 +# Cookie(参考wiki说明获取) +zhilianzhaopin_Cookie = '' +zhilianzhaopin_Search ={ + "pageIndex": "1", + "S_SOU_WORK_CITY": "",#城市ID + "eventScenario": "", + "filterMinSalary": "1", + "S_SOU_EXPAND": "SOU_COMPANY_ID", + "pageSize": "30", + "keywordChange": "1", + "S_SOU_FULL_INDEX": "",#岗位 + "cvNumber": "",#你的ID + "x-zp-utm-client-version": "u", + "rt": "", + "d": "", + "os_version": "14", + "channel": "tengxun", + "version": "8.11.26", + "platform": "4", + "at": "", + "identity": "1", + "businessLine": "com.zhaopin.social", + "anonymous": "0", + "userRole": "0", + "oaid": "" +} +# --------------脉脉-------------------- +maimai_poststate = 0 +# Cookie(参考wiki说明获取) +maimai_Token = ''#你的token,在Cookie +maimai_Cookie = '' +maimai_Search = { + 'city': "",#城市 + 'company_scales': "全部", + 'count': "10", + 'degree': "全部", + 'finances': "全部", + 'fr': "search_job_list_search_job_list", + 'major': "", + 'mj': "", + 'page': "0", + 'pf': "", + 'profession': "", + 'province': "",#省份 + 'query': "",#岗位 + 'rn': "1", + 'salary': "全部", + 'sid': "", + 'sortby': "default", + 'use_native_net': "1", + 'work_times': "全部", + 'version': "6.6.10", + 'ver_code': "", + 'channel': "MyAPP", + 'vc': "Android 14/34", + 'push_permit': "1", + 'net': "wifi", + 'open': "icon", + 'appid': "3", + 'device': "", + 'udid': "", + 'is_push_open': "1", + 'isEmulator': "0", + 'rn_version': "0.69.0", + 'launched_by_user': "1", + 'android_id': "", + 'oaid': "NA", + 'hms_oaid': "", + 'sm_dl': "0", + 'sm_did': "", + 'u': "242374278", + 'access_token': maimai_Token,#你的token + 'webviewUserAgent': "Mozilla/5.0 (Linux; Android 14; 21051182C Build/UQ1A.240105.004.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/128.0.6613.40 Safari/537.36", + 'density': "1.875", + 'screen_width': "", + 'screen_height': "", + 'launch_uuid': "", + 'session_uuid': "", + 'last_launch_time': "" +} +# --------------58同城-------------------- +wubatongcheng_poststate = 0 +# Cookie(参考wiki说明获取) +wubatongcheng_clientid = '' +wubatongcheng_Search = { + 'os': "android", + 'v': "1", + 'curVer': "13.10.2", + 'appId': "1", + 'format': "json", + 'searchType': "newSouList", + 'key': "",#岗位 + 'action': "getListInfo,getFilterInfo,getRecTagInfo", + 'pagetype': "filterList", + 'filterParams': "{\"filterLocalId\":\"-1\",\"filterLocal\":\"\"}", + 'localname': "sz", + 'isNeedAd': "1", + 'page': "1", + 'extendParams': "{\"intentionArray\":[]}" } \ No newline at end of file diff --git a/maimai.py b/maimai.py new file mode 100644 index 0000000..2fedebc --- /dev/null +++ b/maimai.py @@ -0,0 +1,143 @@ +# main_script.py +import requests +import json +from UserDefined import maimai_poststate, maimai_Cookie, maimai_Search, deviceName, maimai_Token +from system import successful_deliveries,maimai_SearchUrl,maimai_PostUrl +def run_maimai_script(): + # 初始化变量 + maimai_successCount = 0 + maimai_errorCount = 0 + maimai_findCount = 0 + page = 1 + # 请求头 + maimai_headers = { + 'User-Agent': "ReactNative//{"+deviceName+"} [Android 14/34]/MaiMai 6.6.10(60610)", + 'Connection': "Keep-Alive", + 'Accept-Encoding': "gzip", + 'content-type': "application/x-www-form-urlencoded", + 'x-maimai-reqid': "776e6ed0252b42bfba9c0772b4d574cf", + 'Cookie': maimai_Cookie + } + while True: + maimai_Search['page'] = str(page) # 设置当前页码 + # response = requests.get(yizhanchi_SearchUrl, params=yizhanchi_Search, headers=headers) + # 发送 GET 请求 + maimai_SearchResponse = requests.get(maimai_SearchUrl, params=maimai_Search, headers=maimai_headers) + # payload = json.dumps(maimai_Search) + # maimai_SearchResponse = requests.post(maimai_SearchUrl, data=payload, headers=maimai_headers) + # print(maimai_SearchResponse.text) + + # 检查请求是否成功 + if maimai_SearchResponse.status_code == 200: + # data = maimai_SearchResponse.json() + + try: + data = maimai_SearchResponse.json() + items = data['data'] + + if not items: + break + + + uuid_list = [item['ejid'] for item in items] + company_list = [item['company'] for item in items] + job_list = [item['position'] for item in items] + salary_desc_list = [item['salary_info'] for item in items] + attraction_list = [item['custom_text'] for item in items] + city_list = [item['city'] for item in items] + + print("------------脉脉-------------") + print("在脉脉平台找到以下岗位,即将为您投递:") + print("---------------------------------") + + for uuid, company, job, salary_desc, attraction, city in zip(uuid_list, company_list, job_list, salary_desc_list, attraction_list, city_list): + attraction_str = json.dumps(attraction, ensure_ascii=False) + # group_items = group_data['msg']['resume'] + # deliver_able_list = [item['deliver_able'] for item in group_items] + # group_list = [item['group_uuid'] for item in group_items] + + # deliver_able_online = deliver_able_list[0] if len(deliver_able_list) > 0 else False + # deliver_able_local = deliver_able_list[1] if len(deliver_able_list) > 1 else False + maimai_findCount=maimai_findCount + 1 + print(f"------------第{maimai_findCount}家-------------") + print(f"UUID: {uuid}") + print(f"公司: {company}") + print(f"城市: {city}") + print(f"岗位: {job}") + print(f"薪资: {salary_desc}") + print(f"福利: {attraction_str}") + # print(f"在线简历投递状态: {'可投递' if deliver_able_online else '不可投递'}") + # print(f"本地简历投递状态: {'可投递' if deliver_able_local else '不可投递'}") + print("-------------Result---------------") + # usegroup = None # 初始化 usegroup + + # if (maimai_poststate == 1 and deliver_able_online) or (maimai_poststate == 2 and not deliver_able_local and deliver_able_online): + # usegroup = group_list[0] + # elif (maimai_poststate == 1 and not deliver_able_online and deliver_able_local) or (maimai_poststate == 2 and deliver_able_local): + # usegroup = group_list[1] + # elif (maimai_poststate == 0 and (deliver_able_online or deliver_able_local)): + # usegroup = None + if (maimai_poststate==1): + maimai_Postpayload = { + 'access_token': maimai_Token, + 'appid': "3", + 'channel': "MyAPP", + 'ejid': uuid, + 'fr': "big_search_job_tab", + 'resume_check': "0", + 'rn': "1", + 'u': "", + 'version': "6.6.10", + 'webviewUserAgent': "Mozilla/5.0 (Linux; Android 14; 21051182C Build/UQ1A.240105.004.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/128.0.6613.40 Safari/537.36" + } + + + maimai_PostResponse = requests.post(maimai_PostUrl, data=maimai_Postpayload, headers=maimai_headers) + try: + data = maimai_PostResponse.json() + maimai_maimai_poststate = data['result'] + if maimai_maimai_poststate == 'ok': + maimai_successCount += 1 + delivery_info = { + "UUID": uuid, + "公司": company, + "城市": city, + "岗位": job, + "薪资": salary_desc, + "福利": attraction_str, + # "投递来自": "在线简历" if usegroup == group_list[0] else "本地简历" + } + successful_deliveries.append(delivery_info) + except Exception as e: + print("脉脉中没有相关工作,请尝试放宽筛选") + print(f"错误信息: {e}") + maimai_errorCount += 1 + # print(maimai_maimai_poststate) + else: + if maimai_poststate == 0: + print("您未开启脉脉投递,本次投递跳过") + # elif maimai_poststate in [1, 2]: + + # print("您已投递过该公司,本次投递跳过") + # maimai_Groupid = {'inuuid': uuid} + + # maimai_GroupResponse = requests.get(maimai_GroupUrl, params=maimai_Groupid, headers=maimai_headers) + + # if maimai_GroupResponse.status_code == 200: + # group_data = maimai_GroupResponse.json() + + + + # except KeyError as e: + # print(f"获取投递状态数据失败: {e}") + # else: + # print(f"投递状态请求失败,HTTP状态码: {maimai_GroupResponse.status_code}") + except Exception as e: + print("脉脉中没有相关工作,请尝试放宽筛选") + print(f"错误信息: {e}") + + else: + print(f"请求失败,HTTP状态码: {maimai_SearchResponse.status_code}") + page += 1 + + return maimai_findCount, maimai_successCount, maimai_errorCount diff --git a/notify.py b/notify.py index 98f9bce..55fd808 100644 --- a/notify.py +++ b/notify.py @@ -2,11 +2,16 @@ import requests import json from UserDefined import poststate, UseResultPush, PushToken, shixiseng_state, yizhanchi_state, bosszhipin_state, \ - bosszhipin_poststate, yizhanchi_poststate, shixiseng_poststate + bosszhipin_poststate, yizhanchi_poststate, shixiseng_poststate, zhilianzhaopin_state, zhilianzhaopin_poststate, \ + maimai_state, maimai_poststate, wubatongcheng_state, wubatongcheng_poststate from bosszhipin import run_bosszhipin_script +from maimai import run_maimai_script from system import ResultUrl, successful_deliveries from shixiseng import run_shixiseng_script +from wubatongcheng import run_wubatongcheng_script from yizhanchi import run_yizhanchi_script +from zhilianzhaopin import run_zhilianzhaopin_script + def send_notifications(): findCount=0 @@ -21,6 +26,15 @@ def send_notifications(): notify_bosszhipin_findCount=0 notify_bosszhipin_successCount=0 notify_bosszhipin_errorCount=0 + notify_zhilianzhaopin_findCount=0 + notify_zhilianzhaopin_successCount=0 + notify_zhilianzhaopin_errorCount=0 + notify_maimai_findCount=0 + notify_maimai_successCount=0 + notify_maimai_errorCount=0 + notify_wubatongcheng_findCount=0 + notify_wubatongcheng_successCount=0 + notify_wubatongcheng_errorCount=0 notify = "------------Notify---------------\n" if poststate in [1, 2]: if(shixiseng_state==1): @@ -47,6 +61,30 @@ def send_notifications(): notify_bosszhipin_successCount=bosszhipin_successCount errorCount=errorCount + bosszhipin_errorCount notify_bosszhipin_errorCount=bosszhipin_errorCount + if(zhilianzhaopin_state==1): + zhilianzhaopin_findCount, zhilianzhaopin_successCount, zhilianzhaopin_errorCount = run_zhilianzhaopin_script() + findCount=findCount + zhilianzhaopin_findCount + notify_zhilianzhaopin_findCount=zhilianzhaopin_findCount + successCount=successCount + zhilianzhaopin_successCount + notify_zhilianzhaopin_successCount=zhilianzhaopin_successCount + errorCount=errorCount + zhilianzhaopin_errorCount + notify_zhilianzhaopin_errorCount=zhilianzhaopin_errorCount + if(maimai_state==1): + maimai_findCount, maimai_successCount,maimai_errorCount = run_maimai_script() + findCount=findCount + maimai_findCount + notify_maimai_findCount=maimai_findCount + successCount=successCount + maimai_successCount + notify_maimai_successCount=maimai_successCount + errorCount=errorCount + maimai_errorCount + notify_maimai_errorCount=maimai_errorCount + if(wubatongcheng_state==1): + wubatongcheng_findCount, wubatongcheng_successCount,wubatongcheng_errorCount = run_wubatongcheng_script() + findCount=findCount + wubatongcheng_findCount + notify_wubatongcheng_findCount=wubatongcheng_findCount + successCount=successCount + wubatongcheng_successCount + notify_wubatongcheng_successCount=wubatongcheng_successCount + errorCount=errorCount + wubatongcheng_errorCount + notify_wubatongcheng_errorCount=wubatongcheng_errorCount notify += (f"今日总共找到{findCount}家公司\n" f"投递成功{successCount}份,投递失败{errorCount}份\n" f"-------------实习僧数据------------\n" @@ -64,6 +102,21 @@ def send_notifications(): f"投递成功{notify_bosszhipin_successCount}份,投递失败{notify_bosszhipin_errorCount}份\n") if(bosszhipin_poststate==0): notify += ( f"您未开启Boss直聘投递,本次投递跳过\n") + notify += ( f"-------------智联招聘数据------------\n" + f"找到{notify_zhilianzhaopin_findCount}家公司\n" + f"投递成功{notify_zhilianzhaopin_successCount}份,投递失败{notify_zhilianzhaopin_errorCount}份\n") + if(zhilianzhaopin_poststate==0): + notify += ( f"您未开启智联招聘投递,本次投递跳过\n") + notify += ( f"-------------脉脉数据------------\n" + f"找到{notify_maimai_findCount}家公司\n" + f"投递成功{notify_maimai_successCount}份,投递失败{notify_maimai_errorCount}份\n") + if(maimai_poststate==0): + notify += ( f"您未开启脉脉投递,本次投递跳过\n") + notify += ( f"-------------58同城数据------------\n" + f"找到{notify_wubatongcheng_findCount}家公司\n" + f"投递成功{notify_wubatongcheng_successCount}份,投递失败{notify_wubatongcheng_errorCount}份\n") + if(wubatongcheng_poststate==0): + notify += ( f"您未开启58同城投递,本次投递跳过\n") try: notify += "---------成功投递的岗位信息-------\n" for delivery in successful_deliveries: diff --git a/system.py b/system.py index 128316b..c19fcac 100644 --- a/system.py +++ b/system.py @@ -9,4 +9,10 @@ yizhanchi_PostUrl = "https://api.izhanchi.com/user/send/" yizhanchi_CitylistUrl = "https://api.izhanchi.com/index/citylist" Bosszhipin_CitylistUrl = "https://www.zhipin.com/wapi/zpCommon/data/cityGroup.json" Bosszhipin_SearchUrl = "https://www.zhipin.com/wapi/zpgeek/search/joblist.json" -Bosszhipin_PostUrl = "https://www.zhipin.com/wapi/zpgeek/friend/add.json" \ No newline at end of file +Bosszhipin_PostUrl = "https://www.zhipin.com/wapi/zpgeek/friend/add.json" +zhilianzhaopin_SearchUrl = "https://cgate.zhaopin.com/positionbusiness/searchrecommend/searchPositions" +zhilianzhaopin_PostUrl = "https://cgate.zhaopin.com/positionbusiness/delivery/positionApply" +maimai_SearchUrl = "https://h3.open.taou.com/maimai/search_front/app/job_search" +maimai_PostUrl = "https://maimai.cn/sdk/jobs/job/send_resume" +wubatongcheng_SearchUrl = "https://app.58.com/api/list/quanzhizhaopin" +wubatongcheng_PostUrl = "https://jlwebapp.58.com//resumedelivery/process" \ No newline at end of file diff --git a/wubatongcheng.py b/wubatongcheng.py new file mode 100644 index 0000000..17c1a4f --- /dev/null +++ b/wubatongcheng.py @@ -0,0 +1,199 @@ +# main_script.py +import requests +import json +from UserDefined import wubatongcheng_poststate, wubatongcheng_clientid, wubatongcheng_Search,deviceName +from system import successful_deliveries,wubatongcheng_SearchUrl,wubatongcheng_PostUrl +def run_wubatongcheng_script(): + # 初始化变量 + wubatongcheng_successCount = 0 + wubatongcheng_errorCount = 0 + wubatongcheng_findCount = 0 + page = 1 + # 请求头 + wubatongcheng_headers = { + 'User-Agent': "okhttp/3.11.0", + 'Connection': "Keep-Alive", + 'Accept-Encoding': "gzip,deflate", + 'net-msg-id': "", + 'x-microservice-name': "APMS", + 'apkbus': "", + 'coordinateType': "10", + 'official': "true", + 'xxzl-cid': "", + 'ua': "21051182C", + 'uuid': "", + 'dirname': "sz", + 'productorid': "1", + 'jumpextra': "{\"spm\":\"\",\"utm_source\":\"\"}", + 'marketchannelid': "1366", + 'osv': "14", + '58clientid': wubatongcheng_clientid, + 'brand': "Xiaomi", + 'apn': "WIFI", + 'deny': "1.875", + 'firstopentime': "", + 'netType': "wifi", + 'rnsoerror': "-1", + 'switchrecommend': "", + 'version': "13.10.2", + 'jumppid': "", + 'push': "0", + 'homemodel': "normal", + 'currentcid': "", + 'buildtime': "", + 'bangbangid': "", + 'xxwxtoken': "", + 'cid': "4", + 'ajkAuthTicket': "", + 'xxzlsid': "", + 'scale': "1", + 'guestImei': "", + 'platform': "android", + 'openudid': "", + 'manufacturer': deviceName, + 'id58': "", + 'PPU': "", + 'sh': "2500", + 'osarch': "arm64-v8a", + 'xxzlcid': "", + 'webua': "Mozilla/5.0 (Linux; U; Android 14; "+deviceName+" Build/UQ1A.240105.004.A1; wv) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/534.30", + 'bundle': "com.wuba", + 'uniqueid': "", + 'totalsize': "", + 'xxaqrid': "", + 'xxwxtokenp': "", + 'product': "58app", + 'sw': "", + 'os': "android", + 'vlocalid': "", + 'r': "", + 'xxzl_deviceid': "", + 'xxzl_smartid': "", + 'xxzl_cid': "", + '58ua': "58app", + 'clinkid': "", + 'maptype': "2", + 'tp': "", + 'channelid': "", + 'jobreferer': "", + 'bgtype': "58app", + 'ZPBEntryLogType': "", + 'xxzlbbid': "", + 'xxzlxxid': "", + 'zpbpubver': "2.10.0", + 'gsparam': "" + } + while True: + wubatongcheng_Search['page'] = str(page) # 设置当前页码 + # response = requests.get(yizhanchi_SearchUrl, params=yizhanchi_Search, headers=headers) + # 发送 GET 请求 + wubatongcheng_SearchResponse = requests.get(wubatongcheng_SearchUrl, params=wubatongcheng_Search, headers=wubatongcheng_headers) + # payload = json.dumps(wubatongcheng_Search) + # wubatongcheng_SearchResponse = requests.post(wubatongcheng_SearchUrl, data=payload, headers=wubatongcheng_headers) + # print(wubatongcheng_SearchResponse.text) + + # 检查请求是否成功 + if wubatongcheng_SearchResponse.status_code == 200: + # data = wubatongcheng_SearchResponse.json() + + try: + data = wubatongcheng_SearchResponse.json() + items = data['jobList']['data'] + + if not items: + break + + + uuid_list = [item['infoID'] for item in items] + company_list = [item['qyname'] for item in items] + job_list = [item['title'] for item in items] + salary_desc_list = [item['xinzi'] for item in items] + attraction_list = [item['signsList'] for item in items] + city_list = [item['quyu'] for item in items] + + print("------------58同城-------------") + print("在58同城平台找到以下岗位,即将为您投递:") + print("---------------------------------") + + for uuid, company, job, salary_desc, attraction, city in zip(uuid_list, company_list, job_list, salary_desc_list, attraction_list, city_list): + attraction_str = json.dumps(attraction, ensure_ascii=False) + # group_items = group_data['msg']['resume'] + # deliver_able_list = [item['deliver_able'] for item in group_items] + # group_list = [item['group_uuid'] for item in group_items] + + # deliver_able_online = deliver_able_list[0] if len(deliver_able_list) > 0 else False + # deliver_able_local = deliver_able_list[1] if len(deliver_able_list) > 1 else False + wubatongcheng_findCount=wubatongcheng_findCount + 1 + print(f"------------第{wubatongcheng_findCount}家-------------") + print(f"UUID: {uuid}") + print(f"公司: {company}") + print(f"城市: {city}") + print(f"岗位: {job}") + print(f"薪资: {salary_desc}") + print(f"福利: {attraction_str}") + # print(f"在线简历投递状态: {'可投递' if deliver_able_online else '不可投递'}") + # print(f"本地简历投递状态: {'可投递' if deliver_able_local else '不可投递'}") + print("-------------Result---------------") + # usegroup = None # 初始化 usegroup + + # if (wubatongcheng_poststate == 1 and deliver_able_online) or (wubatongcheng_poststate == 2 and not deliver_able_local and deliver_able_online): + # usegroup = group_list[0] + # elif (wubatongcheng_poststate == 1 and not deliver_able_online and deliver_able_local) or (wubatongcheng_poststate == 2 and deliver_able_local): + # usegroup = group_list[1] + # elif (wubatongcheng_poststate == 0 and (deliver_able_online or deliver_able_local)): + # usegroup = None + if (wubatongcheng_poststate==1): + wubatongcheng_Postpayload = { + "infoId=uuid&os=android&pt=0&ceping=0&format=json&wechat=0&aiScene=4&ct=4&resumeId=&completeResume=0&deliverySource=8&v=1&curVer=13.10.2&downloadApp=0&appId=1&tjfrom=&synYingcai=0&sidDict=" + } + + + wubatongcheng_PostResponse = requests.post(wubatongcheng_PostUrl, data=wubatongcheng_Postpayload, headers=wubatongcheng_headers) + try: + data = wubatongcheng_PostResponse.json() + wubatongcheng_wubatongcheng_poststate = data['result'] + if wubatongcheng_wubatongcheng_poststate == 'ok': + wubatongcheng_successCount += 1 + delivery_info = { + "UUID": uuid, + "公司": company, + "城市": city, + "岗位": job, + "薪资": salary_desc, + "福利": attraction_str, + # "投递来自": "在线简历" if usegroup == group_list[0] else "本地简历" + } + successful_deliveries.append(delivery_info) + except Exception as e: + print("58同城中没有相关工作,请尝试放宽筛选") + print(f"错误信息: {e}") + wubatongcheng_errorCount += 1 + # print(wubatongcheng_wubatongcheng_poststate) + else: + if wubatongcheng_poststate == 0: + print("您未开启58同城投递,本次投递跳过") + # elif wubatongcheng_poststate in [1, 2]: + + # print("您已投递过该公司,本次投递跳过") + # wubatongcheng_Groupid = {'inuuid': uuid} + + # wubatongcheng_GroupResponse = requests.get(wubatongcheng_GroupUrl, params=wubatongcheng_Groupid, headers=wubatongcheng_headers) + + # if wubatongcheng_GroupResponse.status_code == 200: + # group_data = wubatongcheng_GroupResponse.json() + + + + # except KeyError as e: + # print(f"获取投递状态数据失败: {e}") + # else: + # print(f"投递状态请求失败,HTTP状态码: {wubatongcheng_GroupResponse.status_code}") + except Exception as e: + print("58同城中没有相关工作,请尝试放宽筛选") + print(f"错误信息: {e}") + + else: + print(f"请求失败,HTTP状态码: {wubatongcheng_SearchResponse.status_code}") + page += 1 + + return wubatongcheng_findCount, wubatongcheng_successCount, wubatongcheng_errorCount diff --git a/zhilianzhaopin.py b/zhilianzhaopin.py new file mode 100644 index 0000000..c0916cc --- /dev/null +++ b/zhilianzhaopin.py @@ -0,0 +1,184 @@ +# main_script.py +import requests +import json +from UserDefined import zhilianzhaopin_poststate, zhilianzhaopin_Cookie, zhilianzhaopin_Search,deviceName +from system import successful_deliveries,zhilianzhaopin_SearchUrl,zhilianzhaopin_PostUrl +def run_zhilianzhaopin_script(): + # 初始化变量 + zhilianzhaopin_successCount = 0 + zhilianzhaopin_errorCount = 0 + zhilianzhaopin_findCount = 0 + page = 1 + # 请求头 + zhilianzhaopin_headers = { + + 'User-Agent': "okhttp/4.10.0", + 'Accept-Encoding': "gzip", + 'x-zp-utm-client-version': "u", + 'x-zp-departmentid': "", + 'x-zp-oaid': "", + 'x-zp-rt': "", + 'x-zp-client-id': "", + 'x-zp-version': "8.11.26", + 'x-zp-channel': "tengxun", + 'x-zp-t': "1723836321157", + 'x-zp-client-type': "a", + 'x-zp-page-code': "5019", + 'x-zp-business-system': "95", + 'x-zp-device-id': "", + 'x-zp-user-role': "PERSONALLY", + 'x-zp-at': "51fb6d8c840b490ebd3bb476dc53e229", + 'x-zp-user-agent': "Mozilla/5.0 (Linux; Android 14; "+deviceName+" Build/UQ1A.240105.004.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/128.0.6613.25 Safari/537.36", + 'x-zp-rf': "t", + 'accept-language': "zh-SG,zh;q=0.8", + 'x-zp-zadi': "", + 'x-zp-platform': "4", + 'x-zp-action-id': "", + 'wtoken': "", + 'content-type': "application/json; charset=UTF-8", + 'Cookie': zhilianzhaopin_Cookie + } + while True: + zhilianzhaopin_Search['pageIndex'] = str(page) # 设置当前页码 + # response = requests.get(yizhanchi_SearchUrl, params=yizhanchi_Search, headers=headers) + # 发送 GET 请求 + payload = json.dumps(zhilianzhaopin_Search) + zhilianzhaopin_SearchResponse = requests.post(zhilianzhaopin_SearchUrl, data=payload, headers=zhilianzhaopin_headers) + # print(zhilianzhaopin_SearchResponse.text) + + # 检查请求是否成功 + if zhilianzhaopin_SearchResponse.status_code == 200: + # data = zhilianzhaopin_SearchResponse.json() + + try: + data = zhilianzhaopin_SearchResponse.json() + items = data['data']['list'] + + if not items: + break + + + uuid_list = [item['number'] for item in items] + company_list = [item['companyName'] for item in items] + job_list = [item['name'] for item in items] + salary_desc_list = [item['salary60'] for item in items] + attraction_list = [item['welfareTagList'] for item in items] + city_list = [item['workCity'] for item in items] + + print("------------智联招聘-------------") + print("在智联招聘平台找到以下岗位,即将为您投递:") + print("---------------------------------") + + for uuid, company, job, salary_desc, attraction, city in zip(uuid_list, company_list, job_list, salary_desc_list, attraction_list, city_list): + attraction_str = json.dumps(attraction, ensure_ascii=False) + # group_items = group_data['msg']['resume'] + # deliver_able_list = [item['deliver_able'] for item in group_items] + # group_list = [item['group_uuid'] for item in group_items] + + # deliver_able_online = deliver_able_list[0] if len(deliver_able_list) > 0 else False + # deliver_able_local = deliver_able_list[1] if len(deliver_able_list) > 1 else False + zhilianzhaopin_findCount=zhilianzhaopin_findCount + 1 + print(f"------------第{zhilianzhaopin_findCount}家-------------") + print(f"UUID: {uuid}") + print(f"公司: {company}") + print(f"城市: {city}") + print(f"岗位: {job}") + print(f"薪资: {salary_desc}") + print(f"福利: {attraction_str}") + # print(f"在线简历投递状态: {'可投递' if deliver_able_online else '不可投递'}") + # print(f"本地简历投递状态: {'可投递' if deliver_able_local else '不可投递'}") + print("-------------Result---------------") + # usegroup = None # 初始化 usegroup + + # if (zhilianzhaopin_poststate == 1 and deliver_able_online) or (zhilianzhaopin_poststate == 2 and not deliver_able_local and deliver_able_online): + # usegroup = group_list[0] + # elif (zhilianzhaopin_poststate == 1 and not deliver_able_online and deliver_able_local) or (zhilianzhaopin_poststate == 2 and deliver_able_local): + # usegroup = group_list[1] + # elif (zhilianzhaopin_poststate == 0 and (deliver_able_online or deliver_able_local)): + # usegroup = None + if (zhilianzhaopin_poststate==1): + zhilianzhaopin_Postpayload = json.dumps({ + "st_page": "5019", + "st_action": "601", + "stSourceCode": "5019", + "businessPlatformLabel": "", + "businessTagId": "", + "deliveryWay": "0", + "cycleType": "0", + "exposureType": "0", + "operatePageCode": "5021", + "positionNumbers": uuid, + "cityIds": "765", + "need5Dot0": "1", + "deliveryBusinessType": "0", + "ignoreIntention": "1", + "ignoreBlackType": "0", + "deliveryChannelType": "1", + "isfeedback": "1", + "attachmentDefaultType": "attachment", + "attachmentDefaultFileId": "", + "businessOperation": "POSITION_DETAIL_APPLY", + "resumeVersion": "1", + "resumeNumber": "E7B8AF54DD3376FDA5A9B05CD09B5CC0F6037F86044EB47E5AB3EE3D1ECB9804234E45D6A6C667951BF55660FBE10B1D_A0001", + "language": "3", + "x-zp-utm-client-version": "u", + "rt": "", + "d": "", + "os_version": "14", + "channel": "tengxun", + "version": "8.11.26", + "platform": "4", + "at": "", + "identity": "1", + "businessLine": "com.zhaopin.social", + "anonymous": "0", + "userRole": "0", + "oaid": "" + }) + + zhilianzhaopin_PostResponse = requests.post(zhilianzhaopin_PostUrl, data=zhilianzhaopin_Postpayload, headers=zhilianzhaopin_headers) + data = zhilianzhaopin_PostResponse.json() + zhilianzhaopin_zhilianzhaopin_poststate = data['data']['actionValue'] + if zhilianzhaopin_zhilianzhaopin_poststate == 'SUCCESS': + zhilianzhaopin_successCount += 1 + delivery_info = { + "UUID": uuid, + "公司": company, + "城市": city, + "岗位": job, + "薪资": salary_desc, + "福利": attraction_str, + # "投递来自": "在线简历" if usegroup == group_list[0] else "本地简历" + } + successful_deliveries.append(delivery_info) + else: + zhilianzhaopin_errorCount += 1 + print(zhilianzhaopin_zhilianzhaopin_poststate) + else: + if zhilianzhaopin_poststate == 0: + print("您未开启智联招聘投递,本次投递跳过") + # elif zhilianzhaopin_poststate in [1, 2]: + + # print("您已投递过该公司,本次投递跳过") + # zhilianzhaopin_Groupid = {'inuuid': uuid} + + # zhilianzhaopin_GroupResponse = requests.get(zhilianzhaopin_GroupUrl, params=zhilianzhaopin_Groupid, headers=zhilianzhaopin_headers) + + # if zhilianzhaopin_GroupResponse.status_code == 200: + # group_data = zhilianzhaopin_GroupResponse.json() + + + + # except KeyError as e: + # print(f"获取投递状态数据失败: {e}") + # else: + # print(f"投递状态请求失败,HTTP状态码: {zhilianzhaopin_GroupResponse.status_code}") + except Exception as e: + print("智联招聘中没有相关工作,请尝试放宽筛选") + print(f"错误信息: {e}") + + else: + print(f"请求失败,HTTP状态码: {zhilianzhaopin_SearchResponse.status_code}") + page += 1 + + return zhilianzhaopin_findCount, zhilianzhaopin_successCount, zhilianzhaopin_errorCount