request函数爬取智联招聘
时间: 2024-05-17 09:20:03 浏览: 69
智联招聘岗位信息爬取
好的,以下是使用request函数爬取智联招聘的简单示例代码:
```python
import requests
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
}
url = 'https://fe-api.zhaopin.com/c/i/sou?pageSize=90&cityId=489&workExperience=0103&education=4&companyType=1&employmentType=2&jobWelfareTag=2048&kw=Python&kt=3&lastUrlQuery=%7B%22p%22:1,%22pageSize%22:%2290%22,%22jl%22:%22489%22,%22we%22:%220103%22,%22ed%22:%224%22,%22ct%22:%221%22,%22et%22:%222%22,%22s%22:%222048%22,%22kw%22:%22Python%22,%22kt%22:%223%22%7D'
response = requests.get(url, headers=headers)
print(response.text)
```
这个示例代码使用了requests库,首先设置了请求头headers,然后指定了请求的url,最后使用requests.get()方法发送请求并获取响应,最后打印响应的文本内容。你可以根据自己的需求更改url中的查询参数。
阅读全文