爬取智联招聘
程序员文章站
2022-05-09 17:42:22
...
import requests,json,re
url = 'https://fe-api.zhaopin.com/c/i/sou?pageSize=90&cityId=530&salary=0,0&workExperience=-1&education=-1&companyType=-1&employmentType=-1&jobWelfareTag=-1&kw=python&kt=3&=0&_v=0.93207969&x-zp-page-request-id=2e288187f0904e25b30d1fd4474a369a-1568947137551-570292&x-zp-client-id=c8ceb0d4-a6df-4bdb-9070-fa6796a1aa0e'
response = requests.get(url)
json_obj = json.loads(response.content)
#print(json_obj)
job_list = json_obj['data']['results']
for job in job_list:
name = job['jobName']
#print(name)
pattern = re.compile('[,.]')
company = job['company']['name']
result = pattern.split(company)[0]
#print(result)
data = job['updateDate']
#print(data)
money = job['salary']
#print(money)
city = job['city']['display']
#print(city)
file = open('C:/Users/Administrator/Desktop/123/'+'智联招聘.csv','a',encoding='gb18030')
file.write(name+','+result+','+data+','+money+','+city)
file.write('\n')
file.close()
下一篇: Codeforces 3B Lorry