腾讯招聘岗位爬虫python
时间: 2024-01-20 09:16:34 浏览: 104
以下是使用Python进行腾讯招聘岗位爬虫的示例代码:
```python
import requests
def get_job_positions(keyword):
url = "https://careers.tencent.com/tencentcareer/api/post/Query"
params = {
"timestamp": "1637684846385",
"keyword": keyword,
"pageIndex": "1",
"pageSize": "10",
"language": "zh-cn",
"area": "cn"
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
}
response = requests.get(url, params=params, headers=headers)
data = response.json()
job_positions = []
for item in data["Data"]["Posts"]:
job_positions.append(item["RecruitPostName"])
return job_positions
keyword = "python"
positions = get_job_positions(keyword)
for position in positions:
print(position)
```
这段代码使用了requests库发送GET请求,获取腾讯招聘网站上与关键字匹配的岗位信息。通过解析返回的JSON数据,提取出岗位名称并打印出来。
阅读全文