-
Notifications
You must be signed in to change notification settings - Fork 1
/
CareerBaidu.py
27 lines (22 loc) · 1.01 KB
/
CareerBaidu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import json
import requests
def baiduSearch(page):
retData = requests.post(
"https://talent.baidu.com/httservice/getPostListNew?recruitType=SOCIAL&pageSize=20&keyWord=&curPage=" + str(
page) + "&projectType=",
headers={"Referer": "https://talent.baidu.com/jobs/social-list"})
return retData.text
ResultJson = json.loads(baiduSearch(1))
# 初次请求
total = int(ResultJson["data"]["total"])
NeedIndex = int((total - total % 20) / 20 + 1)
# 计算翻页数
for PageIndex in range(1, NeedIndex):
ResultJson = json.loads(baiduSearch(PageIndex))
PageData = ResultJson["data"]["list"]
for DataIndex in range(0, 19):
Name = PageData[DataIndex]["name"] # 职位名
ServiceCondition = PageData[DataIndex]["serviceCondition"] # 职位条件
WorkContent = PageData[DataIndex]["workContent"] # 工作内容
PostType = PageData[DataIndex]["postType"] # 工作内容
print(Name, ServiceCondition, WorkContent, PostType)