commit 76e6ffb17378f60d8065e638ce1dfd92a1a2fa4e Author: JasonYANG170 Date: Thu Aug 15 17:20:51 2024 +0800 V2.0 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Super_Employees.iml b/.idea/Super_Employees.iml new file mode 100644 index 0000000..2c80e12 --- /dev/null +++ b/.idea/Super_Employees.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c609e9a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..706957e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/UserDefined.py b/UserDefined.py new file mode 100644 index 0000000..79f9cde --- /dev/null +++ b/UserDefined.py @@ -0,0 +1,69 @@ +# --------------------感谢您使用Super Employees自动投递程序--------------------- +# 应用版本V1.0 +# 应用作者: JasonYANG17 +# 仓库地址: https://github.com/JasonYANG170/Super_Employee +# Wiki教程: https://github.com/JasonYANG170/Super_Employee/wiki +# -------------用户配置选项----------------------- +poststate = 1 # 不投递0;投递1; +UseResultPush = 0 # 是否启用推送 +PushToken = '' # 在pushpush网站中可以找到 +# 自定义请求的设备名称 +deviceName='HUAWEI' + + +# --------------平台选择-------------------- +# 开启的平台请务必下滑找到该平台的配置项并填入对应配置 +# 是否启用实习僧 +shixiseng_state = 1 +yizhanchi_state = 1 + +# --------------实习僧配置项-------------------- +# 是否投递(不投递:0,投递优先在线简历:1,投递优先离线简历:2) +shixiseng_poststate = 0 +# Cookie(参考wiki说明获取) +shixiseng_Cookie = '' +# 筛选条件(带‘*’号的为必填项) +shixiseng_Search = { + 'p': "1", + 't': "1", # 智能排序:0,最近发布优先:1 * + 'city': "", # 地区(全国或其他省市) * + 'nature': "", # 类型:股份制企业|合伙企业 + 'scale': "", # 规模:50-150人|500-2000人 + 'ipo': "", # 融资:B轮|A轮 + 'k': "", # 岗位 * + 'degree': "", # 学历:大专|本科 + 'emp_chance': "", # 空间:提供转正|面议 + 'intention': "", # 需求:校招|实习 + 'internship_duration': "", # 在岗时间:1个月|3个月以上 + 'days_per_week': "", # 工作时间:4天|1天 + 'payment_per_day': "" # 日薪:200-300|100以下 +} +# --------------翼展翅配置项-------------------- +# 吐槽一下,翼展翅的数据非常的混乱,有小概率会出现城市筛选失效 +yizhanchi_poststate = 0 +yizhanchi_city="" +yizhanchi_Token ="" +yizhanchi_Search = { + 'page_size': "50",#查询范围 * + 'page': "1",#当前页面 * + 'positiontype': "", + 'minsalary': "",#最低工资 + 'maxsalary': "",#最高工资 + 'show_third_position': "", + 'keyword': "",#岗位 * + 'region_id': "", + 'intern_time_id': "", + 'intern_cycle_id': "", + 'correct_id': "", + 'parttime_duration': "", + 'jianzhitype': "", + 'classid': "", + 'financid': "", + 'natureid': "", + 'scaleid': "", + 'areaid': "", + 'location': "", + 'port': "", + 'region_type': "", + 'sort': "" +} \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..022b68a --- /dev/null +++ b/main.py @@ -0,0 +1,14 @@ +from notify import send_notifications +from system import ResultUrl, successful_deliveries,version +from update import check_for_update +needupdate, tag_name, html_url, body = check_for_update(version) +if(needupdate==0): + send_notifications() +else: + print("-------------发现新版本--------------") + # 打印结果 + print("当前版本:", version) + print("新版本:", tag_name) + print("更新地址:", html_url) + print("更新内容:", body) + print("------------------------------------") diff --git a/notify.py b/notify.py new file mode 100644 index 0000000..0f70a3c --- /dev/null +++ b/notify.py @@ -0,0 +1,79 @@ +# notify.py +import requests +import json +from UserDefined import poststate, UseResultPush, PushToken, shixiseng_state, yizhanchi_state +from system import ResultUrl, successful_deliveries +from shixiseng import run_shixiseng_script +from yizhanchi import run_yizhanchi_script + +def send_notifications(): + findCount=0 + successCount=0 + errorCount=0 + notify_shixiseng_findCount=0 + notify_shixiseng_successCount=0 + notify_shixiseng_errorCount=0 + notify_yizhanchi_findCount=0 + notify_yizhanchi_successCount=0 + notify_yizhanchi_errorCount=0 + notify = "------------Notify---------------\n" + if poststate in [1, 2]: + if(shixiseng_state==1): + shixiseng_findCount, shixiseng_successCount, shixiseng_errorCount = run_shixiseng_script() + findCount=findCount + shixiseng_findCount + notify_shixiseng_findCount=shixiseng_findCount + successCount=successCount + shixiseng_successCount + notify_shixiseng_successCount=shixiseng_successCount + errorCount=errorCount + shixiseng_errorCount + notify_shixiseng_errorCount=shixiseng_errorCount + if(yizhanchi_state==1): + yizhanchi_findCount, yizhanchi_successCount, yizhanchi_errorCount = run_yizhanchi_script() + findCount=findCount + yizhanchi_findCount + notify_yizhanchi_findCount=yizhanchi_findCount + successCount=successCount + yizhanchi_successCount + notify_yizhanchi_successCount=yizhanchi_successCount + errorCount=errorCount + yizhanchi_errorCount + notify_yizhanchi_errorCount=yizhanchi_errorCount + notify += (f"今日总共找到{findCount}家公司\n" + f"投递成功{successCount}份,投递失败{errorCount}份\n" + f"-------------实习僧数据------------\n" + f"找到{notify_shixiseng_findCount}家公司\n" + f"投递成功{notify_shixiseng_successCount}份,投递失败{notify_shixiseng_errorCount}份\n") + if(notify_shixiseng_findCount!=0 and notify_shixiseng_successCount==0 and notify_shixiseng_errorCount==0): + notify += ( f"您未开启实习僧投递,本次投递跳过\n") + notify += ( f"-------------翼展翅数据------------\n" + f"找到{notify_yizhanchi_findCount}家公司\n" + f"投递成功{notify_yizhanchi_successCount}份,投递失败{notify_yizhanchi_errorCount}份\n") + if(notify_yizhanchi_findCount!=0 and notify_yizhanchi_successCount==0 and notify_yizhanchi_errorCount==0): + notify += ( f"您未开启翼展翅投递,本次投递跳过\n") + try: + notify += "---------成功投递的岗位信息-------\n" + for delivery in successful_deliveries: + notify += (f"UUID: {delivery['UUID']}\n" + f"公司: {delivery['公司']}\n" + f"城市: {delivery['城市']}\n" + f"岗位: {delivery['岗位']}\n" + f"薪资: {delivery['薪资']}\n" + f"福利: {delivery['福利']}\n" + # f"投递来自: {delivery['投递来自']}\n" + ) + notify += "-------------------------------\n" + + except Exception as e: + notify += "无\n" + + print(notify) + else: + notify += ("-------------------------------\n" + "未投递,您已选择不投递任何公司\n" + "-------------------------------\n") + + if UseResultPush == 1: + print("您已经开启推送,即将为您推送投递通知") + data = {"token": PushToken, "title": "Super Employees投递通知", "content": notify} + body = json.dumps(data).encode(encoding='utf-8') + Resultheaders = {'Content-Type': 'application/json'} + requests.post(ResultUrl, data=body, headers=Resultheaders) + print("推送完成,任务结束") + else: + print("未开启推送,任务结束") diff --git a/shixiseng.py b/shixiseng.py new file mode 100644 index 0000000..d2789bf --- /dev/null +++ b/shixiseng.py @@ -0,0 +1,128 @@ +# main_script.py +import requests +import json +from UserDefined import shixiseng_poststate, shixiseng_Cookie, shixiseng_Search,deviceName +from system import successful_deliveries,shixiseng_SearchUrl,shixiseng_GroupUrl,shixiseng_PostUrl +def run_shixiseng_script(): + # 初始化变量 + shixiseng_successCount = 0 + shixiseng_errorCount = 0 + shixiseng_findCount = 0 + + # 请求头 + shixiseng_headers = { + 'User-Agent': "sxsandroidapp/4.50.3", + 'devicetoken': "", + 'utm_source': deviceName, + 'jg': "130c83f76128e8b0774", + 'content-type': "application/json; charset=UTF-8", + 'priority': "u=1, i", + 'Cookie': shixiseng_Cookie + } + + # 发送 GET 请求 + shixiseng_SearchResponse = requests.get(shixiseng_SearchUrl, params=shixiseng_Search, headers=shixiseng_headers) + # print(shixiseng_SearchResponse.text) + + # 检查请求是否成功 + if shixiseng_SearchResponse.status_code == 200: + data = shixiseng_SearchResponse.json() + + try: + items = data['msg']['data'] + + uuid_list = [item['uuid'] for item in items] + company_list = [item['company'] for item in items] + job_list = [item['job'] for item in items] + salary_desc_list = [item['salary_desc'] for item in items] + attraction_list = [item['attraction'] for item in items] + city_list = [item['city'] for item in items] + + print("------------实习僧APP-------------") + 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) + shixiseng_Groupid = {'inuuid': uuid} + + shixiseng_GroupResponse = requests.get(shixiseng_GroupUrl, params=shixiseng_Groupid, headers=shixiseng_headers) + + if shixiseng_GroupResponse.status_code == 200: + group_data = shixiseng_GroupResponse.json() + + try: + 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 + shixiseng_findCount=shixiseng_findCount + 1 + print(f"------------第{shixiseng_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 (shixiseng_poststate == 1 and deliver_able_online) or (shixiseng_poststate == 2 and not deliver_able_local and deliver_able_online): + usegroup = group_list[0] + elif (shixiseng_poststate == 1 and not deliver_able_online and deliver_able_local) or (shixiseng_poststate == 2 and deliver_able_local): + usegroup = group_list[1] + elif (shixiseng_poststate == 0 and (deliver_able_online or deliver_able_local)): + usegroup = None + if usegroup: + shixiseng_Postpayload = json.dumps({ + "inuuid": uuid, + "group_uuid": usegroup, + "stype": "attach", + "report_time": "1周内", + "internship_time": "6个月以上", + "days": "5", + "mxa_data": "", + "position": "app_search_xgzw", + "deliver_type": 0 + }) + + shixiseng_PostResponse = requests.post(shixiseng_PostUrl, data=shixiseng_Postpayload, headers=shixiseng_headers) + data = shixiseng_PostResponse.json() + shixiseng_shixiseng_poststate = data['msg']['cont'] + if shixiseng_shixiseng_poststate == 'success': + shixiseng_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: + shixiseng_errorCount += 1 + print(shixiseng_shixiseng_poststate) + else: + if shixiseng_poststate == 0: + print("您未开启实习僧投递,本次投递跳过") + elif shixiseng_poststate in [1, 2]: + + print("您已投递过该公司,本次投递跳过") + except KeyError as e: + print(f"获取投递状态数据失败: {e}") + else: + print(f"投递状态请求失败,HTTP状态码: {shixiseng_GroupResponse.status_code}") + except Exception as e: + print("实习僧中没有相关工作,请尝试放宽筛选") + print(f"错误信息: {e}") + + else: + print(f"请求失败,HTTP状态码: {shixiseng_SearchResponse.status_code}") + + return shixiseng_findCount, shixiseng_successCount, shixiseng_errorCount diff --git a/system.py b/system.py new file mode 100644 index 0000000..6841077 --- /dev/null +++ b/system.py @@ -0,0 +1,8 @@ +successful_deliveries = [] +version='V2.0' +ResultUrl = 'http://www.pushplus.plus/send' +shixiseng_SearchUrl = "https://apigateway-h3.shixiseng.com/api/interns/v3.0/interns/wxz/search/v4" +shixiseng_GroupUrl = "https://apigateway-h3.shixiseng.com/api/deliver/v3.0/deliver/options" +shixiseng_PostUrl = "https://apigateway-h3.shixiseng.com/api/deliver/v3.0/deliver" +yizhanchi_SearchUrl = "https://api.izhanchi.com/position/recommend/index" +yizhanchi_PostUrl = "https://api.izhanchi.com/user/send/" \ No newline at end of file diff --git a/update.py b/update.py new file mode 100644 index 0000000..ed603c3 --- /dev/null +++ b/update.py @@ -0,0 +1,34 @@ +# update.py +import requests +from packaging.version import Version + +def check_for_update(version): + needupdate = 0 + tag_name = "" + html_url = "" + body = "" + + # 发送GET请求到GitHub API以获取最新的release信息 + response = requests.get("https://api.github.com/repos/JasonYANG170/Super_Employee/releases/latest") + + # 检查请求是否成功 + if response.status_code == 200: + # 解析JSON数据 + release_data = response.json() + + # 获取需要的字段 + tag_name = release_data.get("tag_name", "") + html_url = release_data.get("html_url", "") + body = release_data.get("body", "") + + # 比较版本号 + if Version(tag_name.lstrip('V')) > Version(version.lstrip('V')): + needupdate = 1 + else: + needupdate = 0 + else: + print("---------------警告----------------") + print("检查更新错误!使用旧版本可能无法完成投递!", response.status_code) + print("-----------------------------------") + + return needupdate, tag_name, html_url, body diff --git a/yizhanchi.py b/yizhanchi.py new file mode 100644 index 0000000..7163027 --- /dev/null +++ b/yizhanchi.py @@ -0,0 +1,109 @@ +import json +import requests +from datetime import datetime +from datetime import datetime +import time # 引入time模块 +from UserDefined import yizhanchi_Search, yizhanchi_city, deviceName, yizhanchi_poststate, \ + yizhanchi_Token +from system import yizhanchi_SearchUrl, yizhanchi_PostUrl, successful_deliveries + + +def run_yizhanchi_script(): + yizhanchi_findCount=0 + yizhanchi_successCount=0 + yizhanchi_errorCount=0 + headers = { + 'User-Agent': "Mozilla/5.0 (Linux; Android 14;" +deviceName+" Build/UQ1A.240505.004.A1; wv) AppleWebKit/539.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Safari/537.36 XWEB/1170117 MMWEBSDK/20240301 MMWEBID/1139 MicroMessenger/8.0.49.2685(0x28003145) WeChat/arm64 Weixin GPVersion/1 Android Tablet NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android", + 'Accept-Encoding': "gzip,compress,br,deflate", + 'charset': "utf-8", + 'live-channel-id': "", + 'content-type': "application/json; charset=UTF-8", + 'nonce': "0.9293333376178894", + 'share-user-id': "0", + 'promotion-user-id': "0", + 'from': "Android", + 'sign': "3k57a99c0ea677999434cc5a996b2578", + 'business-type': "", + 'page-route': "https://m.izhanchi.com/", + 'business-type-id': "0", + 'region': "zp", + 'Content-Type': "application/json; charset=UTF-8", + 'timestamp': str(int(time.time() * 1000)), # 使用当前时间戳 + 'campus-channel-type': "0", + 'campus-channel-id': "0", + 'token': yizhanchi_Token, + 'appkey': "yizhanchi", + 'version': "H5_3.3.3", + 'Origin': "https://m.izhanchi.com", + 'X-Requested-With': "com.tencent.mm", + 'Sec-Fetch-Site': "same-site", + 'Sec-Fetch-Mode': "cors", + 'Sec-Fetch-Dest': "empty", + 'Referer': "https://m.izhanchi.com/", + 'Accept-Language': "zh-CN,zh-SG;q=0.9,zh;q=0.8,en-US;q=0.7,en;q=0.6,zh-HK;q=0.5" + } + + response = requests.get(yizhanchi_SearchUrl, params=yizhanchi_Search, headers=headers) + data = response.json() + + # 提取职位信息 + items = data['data']['data'] + + # 按照refreshtime字段进行排序,降序排列 + sorted_items = sorted(items, key=lambda x: datetime.strptime(x['refreshtime'], "%Y-%m-%d %H:%M:%S"), reverse=True) + print("------------翼展翅APP-------------") + print("在翼展翅平台找到以下岗位,即将为您投递:") + print("---------------------------------") + # 仅显示 area_name 或 second_area_name 或 city_name 为 '深圳' 的结果 + for item in sorted_items: + city_name = item['city_name'] + area_name = item['area_name'] + second_area_name = item['second_area_name'] + if yizhanchi_city in [city_name, area_name, second_area_name]: + yizhanchi_findCount=yizhanchi_findCount + 1 + print(f"------------第{yizhanchi_findCount}家-------------") + positionid = item['positionid'] + companyname = item['companyname'] + positionname = item['positionname'] + salary_name = item['salary_name'] + refreshtime = item['refreshtime'] + position_strongpoint = item['position_strongpoint'] + print(f"UUID: {positionid}") + print(f"公司: {companyname}") + print(f"城市: {city_name}") + print(f"岗位: {positionname}") + print(f"薪资: {salary_name}") + print(f"福利: {position_strongpoint}") + print(f"HR刷新时间: {refreshtime}") + print("-------------Result---------------") + if(yizhanchi_poststate==1): + yizhanchi_postparams = { + 'attachment_id': "", + 'qiniu_id': "", + 'is_top': "1", + 'deliery_source': "4", + 'specific_source': "", + 'source': "" + } + yizhanchi_Postresponse = requests.get(yizhanchi_PostUrl+positionid, params=yizhanchi_postparams, headers=headers) + data = yizhanchi_Postresponse.json() + yizhanchi_yizhanchi_poststate = data['message'] + if yizhanchi_yizhanchi_poststate == '投递成功': + yizhanchi_successCount += 1 + delivery_info = { + "UUID": positionid, + "公司": companyname, + "城市": city_name, + "岗位": positionname, + "薪资": salary_name, + "福利": position_strongpoint, + # "投递来自": "在线简历" if usegroup == group_list[0] else "本地简历" + } + successful_deliveries.append(delivery_info) + else: + yizhanchi_errorCount += 1 + print("投递失败,请查看返回信息:") + print(yizhanchi_yizhanchi_poststate) + else: + print("您未开启翼展翅投递,本次投递跳过") + return yizhanchi_findCount, yizhanchi_successCount, yizhanchi_errorCount \ No newline at end of file