import requests
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'
}
def parse_url():
url = 'https://careers.tencent.com/tencentcareer/api/post/Query?timestamp=1564727219057&countryId=&cityId=3&bgIds=&productId=&categoryId=&parentCategoryId=&attrId=&keyword=python&pageIndex=2&pageSize=10&language=zh-cn&area=cn'
response = requests.get(url, headers=headers)
json_position = response.json()
position_list = json_position['Data']['Posts']
page_one_position_list = []
for single_positon in position_list:
position_name = single_positon['RecruitPostName']
location_name = single_positon['LocationName']
responsibility = single_positon['Responsibility']
#详情页的url
Post_url = single_positon['PostURL']
position = {
'工作岗位':position_name,
'工作地点':location_name,
'工作详情':responsibility,
'详情url':Post_url
}
page_one_position_list.append(position)
print(page_one_position_list)
if __name__ == '__main__':
parse_url()