python智聯(lián)招聘爬蟲(chóng)并導(dǎo)入到excel代碼實(shí)例
這篇文章主要介紹了python智聯(lián)招聘爬蟲(chóng)并導(dǎo)入到excel代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
寫(xiě)了一個(gè)智聯(lián)招聘的爬蟲(chóng),只要輸入職位關(guān)鍵字,就能快速導(dǎo)出智聯(lián)招聘上的數(shù)據(jù),存在excel表里~
import requests,openpyxl
#建立excel表
joblist=[]
wb=openpyxl.Workbook()
sheet=wb.active
sheet.title='智聯(lián)招聘數(shù)據(jù)'
sheet['A1']='職位名稱'
sheet['B1']='薪資'
sheet['C1']='工作經(jīng)驗(yàn)'
#爬蟲(chóng)
keyword=str(input('請(qǐng)輸入查找職位的關(guān)鍵字:'))
url='https://fe-api.zhaopin.com/c/i/sou'
headers={
'Referer': 'https://sou.zhaopin.com/?p=2&jl=653&et=2&kw=%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90&kt=3&sf=0&st=0',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15'
}
for n in range(5):
params={
'start': str(90*n),
'pageSize': '90',
'cityId': '653',
'salary': '0,0',
'workExperience': '-1',
'education':'4',
'companyType': '-1',
'employmentType': '2',
'jobWelfareTag': '-1',
'kw': keyword,
'kt': '3',
'at': '9faf2d5cc87b4141a33c493c248ce1eb',
'rt': 'c678689ef9144475b2030fe55c12fe5c',
'_v': '0.53075950',
'userCode': '638259962',
'x-zp-page-request-id': '9eb3c2c955dd4a8db3c8224a177ebdd5-1567575573029-133510',
'x-zp-client-id': 'cd7e0b11-a761-4a2f-a8be-2e6a9da3f068'
}
res=requests.get(url,headers=headers,params=params)
jsonres=res.json()
positions=jsonres['data']['results']
for position in positions:
jobname=position['jobName']
salary=position['salary']
workingExp=position['workingExp']['name']
joblist.append([jobname,salary,workingExp])
#寫(xiě)入excel
for row in joblist:
sheet.append(row)
wb.save('智聯(lián)招聘數(shù)據(jù).xlsx')
print('數(shù)據(jù)爬取成功!')
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
pandas按若干個(gè)列的組合條件篩選數(shù)據(jù)的方法
下面小編就為大家分享一篇pandas按若干個(gè)列的組合條件篩選數(shù)據(jù)的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-04-04
Python實(shí)現(xiàn)Word文檔轉(zhuǎn)換Markdown的示例
這篇文章主要介紹了Python實(shí)現(xiàn)Word文檔轉(zhuǎn)換Markdown的示例,幫助大家更好的理解和使用python,感興趣的朋友可以了解下2020-12-12
pytorch 如何使用batch訓(xùn)練lstm網(wǎng)絡(luò)
這篇文章主要介紹了pytorch 如何使用batch訓(xùn)練lstm網(wǎng)絡(luò)的操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-05-05
Python讀取DataFrame的某行或某列的方法實(shí)現(xiàn)
Dataframe是Python中一種重要的數(shù)據(jù)處理工具,它能夠以表格形式存儲(chǔ)并處理數(shù)據(jù),本文主要介紹了Python讀取DataFrame的某行或某列的方法實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下2024-04-04
python求兩個(gè)時(shí)間的時(shí)間差(實(shí)例代碼)
python 多維切片之冒號(hào)和三個(gè)點(diǎn)的用法介紹
一篇文章搞懂Python程序流程控制結(jié)構(gòu)

