V3.0:Support new platforms

This commit is contained in:
JasonYANG170 2024-08-16 20:54:57 +08:00
parent b2ff09831e
commit 67d8d45484
7 changed files with 362 additions and 194 deletions

View File

@ -29,7 +29,7 @@
(除Linkedin外推荐使用中国IP部署)
## 支持平台
- ✅ 实习僧
- ✅ 展翅
- ✅ 展翅
- 🚧 Boss直聘
- 🚧 51 Job
- 🚧 Linkedin

View File

@ -16,7 +16,7 @@ deviceName='HUAWEI'
# 是否启用实习僧
shixiseng_state = 1
yizhanchi_state = 1
bosszhipin_state = 1
# --------------实习僧配置项--------------------
# 是否投递(不投递:0,投递优先在线简历:1,投递优先离线简历:2)
shixiseng_poststate = 0
@ -30,27 +30,26 @@ shixiseng_Search = {
'nature': "", # 类型:股份制企业|合伙企业
'scale': "", # 规模50-150人|500-2000人
'ipo': "", # 融资B轮|A轮
'k': "", # 岗位 *
'degree': "", # 学历:大专|本科
'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_Cookie =""
yizhanchi_Search = {
'page_size': "50",#查询范围 *
'page_size': "1000",#查询范围 *
'page': "1",#当前页面 *
'positiontype': "",
'minsalary': "",#最低工资
'maxsalary': "",#最高工资
'show_third_position': "",
'keyword': "",#岗位 *
'keyword': "软件 ",#岗位 *
'region_id': "",
'intern_time_id': "",
'intern_cycle_id': "",
@ -67,3 +66,26 @@ yizhanchi_Search = {
'region_type': "",
'sort': ""
}
# --------------Boss直聘配置项--------------------
bosszhipin_poststate = 0
bosszhipin_city=""
bosszhipin_Cookie =""
bosszhipin_Search = {
'scene': "1",
'query': "嵌入式",#岗位
'city': "",
'experience': "",
'payType': "",
'partTime': "",
'degree': "",
'industry': "",
'scale': "",
'stage': "",
'position': "",
'jobType': "",
'salary': "",
'multiBusinessDistrict': "",
'multiSubway': "",
'page': "1",
'pageSize': "5000"
}

113
bosszhipin.py Normal file
View File

@ -0,0 +1,113 @@
import time
import requests
import json
from UserDefined import bosszhipin_city, bosszhipin_Search, bosszhipin_poststate, bosszhipin_Cookie
from system import Bosszhipin_CitylistUrl, Bosszhipin_SearchUrl, successful_deliveries, Bosszhipin_PostUrl
def run_bosszhipin_script():
# 初始化计数器
bosszhipin_findCount = 0
bosszhipin_successCount = 0
bosszhipin_errorCount = 0
page = 1
# 请求头
headers = {
'User-Agent': "Mozilla/5.0 (Linux; Android 14; 21051182C Build/UQ1A.240105.004.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Safari/537.36 XWEB/1160117 MMWEBSDK/20240501 MMWEBID/1136 MicroMessenger/8.0.49.2685(0x28003145) WeChat/arm64 Weixin GPVersion/1 Android Tablet NetType/WIFI Language/zh_CN ABI/arm64",
'Accept-Encoding': "gzip, deflate",
'traceid': "F-e38d9aCURcZEnWMK",
'x-requested-with': "XMLHttpRequest",
'sec-fetch-site': "same-origin",
'sec-fetch-mode': "cors",
'sec-fetch-dest': "empty",
'referer': "https://www.zhipin.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",
'Cookie': bosszhipin_Cookie # 将这个替换为你的实际cookie
}
# 发送GET请求获取城市代码
response = requests.get(Bosszhipin_CitylistUrl, headers=headers)
data = response.json()
# 遍历 cityGroup 查找 name 为bosszhipin_city的城市对应的 code
city_code = None
for group in data['zpData']['cityGroup']:
for city in group['cityList']:
if city['name'] == bosszhipin_city:
city_code = city['code']
break
if city_code is not None:
break
print(f"{bosszhipin_city}的code值:", city_code)
try:
while True:
bosszhipin_Search['page'] = str(page) # 设置当前页码
response = requests.get(Bosszhipin_SearchUrl, params=bosszhipin_Search, headers=headers)
data = response.json()
print(response.text)
item_list = data['zpData']['jobList']
if not item_list:
break
print("------------Boss直聘-------------")
print("在Boss直聘平台找到以下岗位即将为您投递:")
print("---------------------------------")
for item in item_list:
bosszhipin_findCount += 1
print(f"------------第{bosszhipin_findCount}家-------------")
encryptJobId = item.get('encryptJobId')
brandName = item.get('brandName')
jobName = item.get('jobName')
cityName = item.get('cityName')
salaryDesc = item.get('salaryDesc')
securityId = item.get('securityId')
welfareList=item.get('welfareList')
lid = item.get('lid')
print(f"UUID: {encryptJobId}")
print(f"公司: {brandName}")
print(f"城市: {cityName}")
print(f"岗位: {jobName}")
print(f"薪资: {salaryDesc}")
print(f"福利: {welfareList }")
# print(f"HR刷新时间: {lid}")
print("-------------Result---------------")
if(bosszhipin_poststate==1):
bosszhipin_postparams = {
"securityId": securityId,
"jobId": encryptJobId,
"lid": lid
}
bosszhipin_Postresponse = requests.get(Bosszhipin_PostUrl, params=bosszhipin_postparams, headers=headers)
data = bosszhipin_Postresponse.json()
bosszhipin_bosszhipin_poststate = data['message']
if bosszhipin_bosszhipin_poststate == '投递成功':
bosszhipin_successCount += 1
delivery_info = {
"UUID": encryptJobId,
"公司": brandName,
"城市": cityName,
"岗位": jobName,
"薪资": salaryDesc,
"福利": welfareList,
}
successful_deliveries.append(delivery_info)
else:
bosszhipin_errorCount += 1
print("投递失败,请查看返回信息:")
print(bosszhipin_bosszhipin_poststate)
else:
print("您未开启Boss直聘投递本次投递跳过")
# 投递逻辑在这里添加
# time.sleep(10)
page += 1 # 页码自增
except Exception as e:
print("Boss直聘Cookie失效请更新Cookie")
print(f"错误信息: {e}")
return bosszhipin_findCount, bosszhipin_successCount, bosszhipin_errorCount

View File

@ -1,7 +1,9 @@
# notify.py
import requests
import json
from UserDefined import poststate, UseResultPush, PushToken, shixiseng_state, yizhanchi_state
from UserDefined import poststate, UseResultPush, PushToken, shixiseng_state, yizhanchi_state, bosszhipin_state, \
bosszhipin_poststate, yizhanchi_poststate, shixiseng_poststate
from bosszhipin import run_bosszhipin_script
from system import ResultUrl, successful_deliveries
from shixiseng import run_shixiseng_script
from yizhanchi import run_yizhanchi_script
@ -16,6 +18,9 @@ def send_notifications():
notify_yizhanchi_findCount=0
notify_yizhanchi_successCount=0
notify_yizhanchi_errorCount=0
notify_bosszhipin_findCount=0
notify_bosszhipin_successCount=0
notify_bosszhipin_errorCount=0
notify = "------------Notify---------------\n"
if poststate in [1, 2]:
if(shixiseng_state==1):
@ -34,18 +39,31 @@ def send_notifications():
notify_yizhanchi_successCount=yizhanchi_successCount
errorCount=errorCount + yizhanchi_errorCount
notify_yizhanchi_errorCount=yizhanchi_errorCount
if(bosszhipin_state==1):
bosszhipin_findCount, bosszhipin_successCount, bosszhipin_errorCount = run_bosszhipin_script()
findCount=findCount + bosszhipin_findCount
notify_bosszhipin_findCount=bosszhipin_findCount
successCount=successCount + bosszhipin_successCount
notify_bosszhipin_successCount=bosszhipin_successCount
errorCount=errorCount + bosszhipin_errorCount
notify_bosszhipin_errorCount=bosszhipin_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):
if(shixiseng_poststate==0):
notify += ( f"您未开启实习僧投递,本次投递跳过\n")
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")
if(yizhanchi_poststate==0):
notify += ( f"您未开启易展翅投递,本次投递跳过\n")
notify += ( f"-------------Boss直聘数据------------\n"
f"找到{notify_bosszhipin_findCount}家公司\n"
f"投递成功{notify_bosszhipin_successCount}份,投递失败{notify_bosszhipin_errorCount}\n")
if(bosszhipin_poststate==0):
notify += ( f"您未开启Boss直聘投递本次投递跳过\n")
try:
notify += "---------成功投递的岗位信息-------\n"
for delivery in successful_deliveries:

View File

@ -8,7 +8,7 @@ def run_shixiseng_script():
shixiseng_successCount = 0
shixiseng_errorCount = 0
shixiseng_findCount = 0
page = 1
# 请求头
shixiseng_headers = {
'User-Agent': "sxsandroidapp/4.50.3",
@ -19,18 +19,25 @@ def run_shixiseng_script():
'priority': "u=1, i",
'Cookie': shixiseng_Cookie
}
while True:
shixiseng_Search['p'] = str(page) # 设置当前页码
# response = requests.get(yizhanchi_SearchUrl, params=yizhanchi_Search, headers=headers)
# 发送 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()
# data = shixiseng_SearchResponse.json()
try:
data = shixiseng_SearchResponse.json()
items = data['msg']['data']
if not items:
break
uuid_list = [item['uuid'] for item in items]
company_list = [item['company'] for item in items]
job_list = [item['job'] for item in items]
@ -38,7 +45,7 @@ def run_shixiseng_script():
attraction_list = [item['attraction'] for item in items]
city_list = [item['city'] for item in items]
print("------------实习僧APP-------------")
print("------------实习僧-------------")
print("在实习僧平台找到以下岗位,即将为您投递:")
print("---------------------------------")
@ -124,5 +131,6 @@ def run_shixiseng_script():
else:
print(f"请求失败HTTP状态码: {shixiseng_SearchResponse.status_code}")
page += 1
return shixiseng_findCount, shixiseng_successCount, shixiseng_errorCount

View File

@ -6,3 +6,7 @@ shixiseng_GroupUrl = "https://apigateway-h3.shixiseng.com/api/deliver/v3.0/deliv
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/"
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"

View File

@ -1,66 +1,66 @@
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
import time
from UserDefined import yizhanchi_Search, yizhanchi_city, deviceName, yizhanchi_poststate, yizhanchi_Cookie
from system import yizhanchi_SearchUrl, yizhanchi_PostUrl, successful_deliveries, yizhanchi_CitylistUrl
def run_yizhanchi_script():
yizhanchi_findCount = 0
yizhanchi_successCount = 0
yizhanchi_errorCount = 0
page = 1
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",
'User-Agent': f"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,
'timestamp': str(int(time.time() * 1000)),
'Cookie': yizhanchi_Cookie,
'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)
response = requests.get(yizhanchi_CitylistUrl, headers=headers)
data = response.json()
# 提取职位信息
yizhanchi_city_id = None
for item in data["data"]:
if item["name"] == yizhanchi_city:
yizhanchi_city_id = item["id"]
break
if yizhanchi_city_id is not None:
print(f'{yizhanchi_city}的id值是: {yizhanchi_city_id}')
else:
print(f'没有找到 name 为 "{yizhanchi_city}" 的数据')
return yizhanchi_findCount, yizhanchi_successCount, yizhanchi_errorCount
yizhanchi_Search['region_id'] = f"{yizhanchi_city_id}"
while True:
yizhanchi_Search['page'] = str(page) # 设置当前页码
response = requests.get(yizhanchi_SearchUrl, params=yizhanchi_Search, headers=headers)
data = response.json()
items = data['data']['data']
# 按照refreshtime字段进行排序降序排列
if not items:
break
sorted_items = sorted(items, key=lambda x: datetime.strptime(x['refreshtime'], "%Y-%m-%d %H:%M:%S"), reverse=True)
print("------------翼展翅APP-------------")
print("在翼展翅平台找到以下岗位,即将为您投递:")
print("------------易展翅-------------")
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
if '深圳' in [city_name, area_name, second_area_name]:
yizhanchi_findCount += 1
print(f"------------第{yizhanchi_findCount}家-------------")
positionid = item['positionid']
companyname = item['companyname']
@ -76,7 +76,8 @@ def run_yizhanchi_script():
print(f"福利: {position_strongpoint}")
print(f"HR刷新时间: {refreshtime}")
print("-------------Result---------------")
if(yizhanchi_poststate==1):
if yizhanchi_poststate == 1:
yizhanchi_postparams = {
'attachment_id': "",
'qiniu_id': "",
@ -97,7 +98,6 @@ def run_yizhanchi_script():
"岗位": positionname,
"薪资": salary_name,
"福利": position_strongpoint,
# "投递来自": "在线简历" if usegroup == group_list[0] else "本地简历"
}
successful_deliveries.append(delivery_info)
else:
@ -105,5 +105,8 @@ def run_yizhanchi_script():
print("投递失败,请查看返回信息:")
print(yizhanchi_yizhanchi_poststate)
else:
print("您未开启翼展翅投递,本次投递跳过")
print("您未开启易展翅投递,本次投递跳过")
page += 1 # 页码自增
return yizhanchi_findCount, yizhanchi_successCount, yizhanchi_errorCount