其他分享
首页 > 其他分享> > 智联招聘职位信息

智联招聘职位信息

作者:互联网

"""
author:张鑫
date:2021/10/28 10:48
"""
import json
import re
import time
import random
import pandas as pd
import requests
for i in range(1,20):
print(f'***********************第{i}页***********************')
time.sleep(random.randint(3,5))
url = f'https://sou.zhaopin.com/?kw=python%E7%88%AC%E8%99%AB%E5%B7%A5%E7%A8%8B%E5%B8%88&jl=530&p={i}'
headers = {
'cookie': 'x-zp-client-id=6da11c23-ca0d-4d06-e6b0-45f6d558c2bb; urlfrom2=121114589; adfcid2=cn.bing.com; adfbid2=0; sts_deviceid=17cbbe57450d5f-021835ee5f203e-561a145a-1327104-17cbbe57451eee; FSSBBIl1UgzbN7NO=5yp3trDWzX3l_Y5HGhR9kA37nevkjLICfN1qRgY9QBJifuEUKuRYW.G4tRGCHpzIlK656jIOsCSiRhwmP0yXMJa; _uab_collina=163523996654218802484759; locationInfo_search={%22code%22:%22530%22%2C%22name%22:%22%E5%8C%97%E4%BA%AC%22%2C%22message%22:%22%E5%8C%B9%E9%85%8D%E5%88%B0%E5%B8%82%E7%BA%A7%E7%BC%96%E7%A0%81%22}; at=7cae5fb28f894a7582ca12b795adee4f; rt=90dbcfe0310347ee9bd42fa178c730d4; ssxmod_itna=iqmx2QDtemwxc0Dz=Qbq0K0QNRDDwF4FRRP0=HDlxoxA5D8D6DQeGTbR3sbeseN/mBmfG8UliqKawK03gRTNC/rPNdDU4i8DCTqxoomDYYkDt4DTD34DYDixibCxi5GRD0KDF7dy/1yDYPDE0KDaxDbDiekIxGCDeKD0xwFDQKDu29Ks0F+8c71atvKo8GxjxG1H40HNj3vrRfLsjH+m8fQeC4DUBuUKl25MRGbNYA3Ix0koq0Oya5sCagUXc5z49wTzY2a7Y2qjAhxo0DY3=DPI/co7D4N7el5Gi+7FCPyDDaKCshDD; ssxmod_itna2=iqmx2QDtemwxc0Dz=Qbq0K0QNRDDwF4FRRP0=D6pfrGx0v2x038KvcU2euD6QQdud4B/PQ2dP/QAoYQQKF/0gLe=M1dBE7s/BwGykX7B65hE+k1Zmyx8+g0yqG8/meYFGKiSzO+GKl+KB2iiNmna9QwkXQaNThnz/=qx9m4DwO5DLxG7sYD=; selectCity_search=530; ZP_OLD_FLAG=false; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%221002582141%22%2C%22first_id%22%3A%2217cbbe5745eaff-012b796ee5f1883-561a145a-1327104-17cbbe5745fb75%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%2217cbbe5745eaff-012b796ee5f1883-561a145a-1327104-17cbbe5745fb75%22%7D; acw_tc=2760826816353884711563702ec7cc8b48b04486e1a7e89e3d8a78b4165879; Hm_lvt_38ba284938d5eddca645bb5e02a02006=1635239949,1635302157,1635315461,1635388473; d4d6cd0b4a19fa72b8cc377185129bb7=b67d976c-8210-48ac-87a9-2b167e6db4d5; zpfe_probe_token=33beb574s60e3643f2a817490eb155e2a655; Hm_lpvt_38ba284938d5eddca645bb5e02a02006=1635388479; FSSBBIl1UgzbN7NP=53ULWHbm_kkgqqqmZSW0YOqom3.0aVqKQmJ9DFNlpbg7y2FTVQStoJAAxIAPJoXs.Of8F7QlklT8viZYOO7W8QEfQRzRHt0E36AWh7uyRIv8HfbDuJCB_d.17_A6hK6SJRcl57y1IQrx3wi06yyXvHjQ53EEHJWoWw5.P8GQ1zJaYWG9SyMwk74m2EEuar9zgrAAF__Eksmlqgmryr73Cjm7dOBFeqWEzfQ.9wd_q465rGo8Xi_EjFerZYKLoxrGodsTlpUx5YJJ8TQIMJQGVb0IdTeGRGpfUOimK4k.cP2ZJda3dkWKXpmORMUppFHrpfw4sh_dteVVZp_C6S4pHOV',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.30',
}
html = requests.get(url=url, headers=headers).content.decode()
html = re.findall('"positionList":(.*?),"isSupportBatchDelivery":', html)

html = json.loads(''.join(html))
data = {}
companyNames = []
companyNumbers = []
companyRootIds = []
companySizes = []
companyUrls = []
educations = []
industryNames = []
jobIds = []
names = []
salary60s = []
skillLabels = []
welfareLabels = []
workCitys = []
workTypes = []
workingExps = []


for item in html:
# 公司名称
companyName = item['companyName']
companyNames.append(companyName)
# 公司编号
companyNumber = item['companyNumber']
companyNumbers.append(companyNumber)
# 公司id
companyRootId = item['companyRootId']
companyRootIds.append(companyRootId)
# 公司规模
companySize = item['companySize']
companySizes.append(companySize)
# 公司官网
companyUrl = item['companyUrl']
companyUrls.append(companyUrl)
# 学历要求
education = item['education']
educations.append(education)
# 行业名称
industryName = item['industryName']
industryNames.append(industryName)
# 工作id
jobId = item['jobId']
jobIds.append(jobId)
# 职位名称
name = item['name']
names.append(name)
# 工资待遇
salary60 = item['salary60']
salary60s.append(salary60)
# 技能要求

skillLabel = item['skillLabel']
skillLabels.append(skillLabel)
# res = [item[key] for item in skillLabel for key in item]
# skillLabel = []
# for res in res:
# if res == 0:
# pass
# else:
# skillLabel.append(res)
# skillLabel=skillLabel
# print(skillLabel)
# 福利待遇
welfareLabel = item['welfareLabel']
welfareLabels.append(welfareLabel)
# res = [item[key] for item in welfareLabel for key in item]
# welfareLabel = []
# for res in res:
# if res == 0:
# pass
# else:
# welfareLabel.append(res)
# welfareLabel=welfareLabel
# print(welfareLabel)
# 工作城市
workCity = item['workCity']
workCitys.append(workCity)
# 工作类型
workType = item['workType']
workTypes.append(workType)
# 工作经验
workingExp = item['workingExp']
workingExps.append(workingExp)

print(
len(companyNames),
len(companyNumbers),
len(companyRootIds),
len(companySizes),
len(companyUrls),
len(educations),
len(jobIds),
len(names),
len(salary60s),
len(skillLabels),
len(welfareLabels),
len(workCitys),
len(workTypes),
len(workingExps),

)

data = {
'公司名称': companyNames,
'公司编号': companyNumbers,
'公司id': companyRootIds,
'公司规模': companySizes,
'公司官网': companyUrls,
'学历要求': educations,
'行业名称': industryNames,
'工作id': jobIds,
'职位名称': names,
'工资待遇': salary60s,
'技能要求': (skillLabels),
'福利待遇': (welfareLabels),
'工作城市': workCitys,
'工作类型': workTypes,
'工作经验': workingExps,
}
s = pd.DataFrame(data)
s.to_excel('北京python爬虫工程师招聘信息.xlsx', 'a', encoding='utf-8')
print('保存成功')
# print(s)
print(data)

标签:职位,E5%,res,22%,招聘,len,item,智联,append
来源: https://www.cnblogs.com/wolvies/p/15498177.html