Spider

Java86

流程:

迭代进行:种子url->Element遍历获取超链接lin->作为新种子id

⚠️注意频率和遍历深度

1.设定url及请求参数

headers = {"user-agent": "Baiduspider"}base_url = "https://www.zhihu.com"suffix = "/explore"entry_url = base_url + suffix

2.读取请求返回结果,及解析

```
response = requests.get(entry_url, headers=headers).textsoup = bs4.BeautifulSoup(response, "lxml")page_set = soup.find_all("a")

输入验证码查看隐藏内容

扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长