1、requests模块的认识
requests模块的认识请跳转到 requests请求库使用_使用requests库-CSDN博客
2、爬取数据
这里我们以b站动漫追番人数为例。
首先进去b站官网

鼠标右键点击检查或者键盘的F12,进入开发者模式。(这里我使用的是谷歌浏览器为例)

然后使用 ctrl+f 进入搜索模式,搜索 鬼灭之刃 柱训练篇 ,然后点击该页面的标头 ,把请求网址 和载荷中的数据复制下来复制下来,还有user-agent。
(请求方法为GET;content-type : application/json)

进去pycharm中使用requests模块,将复制的请求网址(?号前的)放入url中,复制的载荷中的数据变成字典并且命名为params,将复制的 user-agent 也变为字典形式命名为headers。
使用requests模块中自带的json进行对数据解析(上文中的content-type就是请求下来的格式),在解析完成后得到的是一个字典格式的数据,然后获取想要的数据。

请求完成后,获取的数据。
