爬虫之 App 爬取

时间:2022-05-22 00:09:14

- 移动端数据的爬取
- 抓包工具:
- fiddler
- 青花瓷
- miteproxy

- 环境的搭建
1.对fiddler进行配置:tools-》options-》connections->Allow remote cooxxx->设定一个端口
2.测试端口是否可用:在pc浏览器中访问localhost:8886
3.pc开启一个热点,让手机去连接(保证了手机和fiddler所在的pc是在同一网段下)
4.在手机*问localhost:8886进行证书的安装且信任
5.在手机中设置代理
- 手机连接的wifi中设定代理ip和端口(都是基于fiddler)

import requests
# headers = {
# # 'User-Agent':'qu tou tiao/3.6.1 (iPhone; iOS 12.3.1; Scale/3.00)/qukan_ios'
# # }
# # url = 'https://api.1sapp.com/content/getListV2?qdata=NTRGQzhENkZFMUE1M0I2NkM0QzU2MjZGOEQ3NjI1RkQuY0dGeVlXMGZPRVEyTTBaRFJVTXRRalE0TlMwME1qVkdMVGswUmtNdFEwVkVOemt4TlVRM09ETTJIblpsY25OcGIyNGZOaDV3YkdGMFptOXliUjlwYjNNZVpXTWZNUT09LtagD4vABRxcsa6fa7qpeSB5kCo897LVZGyk2MyKfjIoRx0c9SbUZYexOhselSV%2BhoaUc/BpFA764n5CPUQajjBkMtkiUyhnw9JMPLBL7yfzwHlqwoBf2b%2BqG%2BfJgeug73zQATh9Gm5HaQZcuMV6M2mehrfdVi3hFwSyCVtun8zAqlDpP8hSBrjfiJf8v5%2BqDJzJo9zW8k2dX%2B%2B/o30iwq/Cy2FXeqz8izPZXQO5%2BLDLXmYCKplQzRYT51GIQzIybsgg/sb/as5aziAwV95SpihCfwh1I0c86pOAs5egm93wR3%2Bt/p/PIaubhxsIrA9SFpxkBULVx48Rj/C997VsBbYD7gsNsLtnAqb14V1ZEa1P8OA3yXxW9Hn7C87IVXfm24NBZoZyA6kDh2OP0jP1bItQciJuCAd9mODlSmwxVthrf6iY/PZcl9G4P13%2B1PfCz32kSDItFxLIrtYk%2BOfgjaC3ct9EzjMTEY7SjM0jKQ8lFSEj6cbmZGZIIJcNiSLnokFHAaVDTygfcvmjqrifhYc7pQzzEfqrkPNycl3SC36XU2v16uA5brE4vOUdx2AS2mD%2BH5BGQJOgPgvK6FuFjOaHW1nt9XQCAhwCF4QPSO11z6QyQo0mEbsTeWhvVmnN1BCgOlOI985qquH1nRL/3XGyIK%2B36E2icJZcJxMwi1QM%2BReUsbBLkzX3mYq/hGWeG7nvJUwEI5jhmM1tvI3QRiFK%2B1Zn1DIQVnYOEc8PJwR0rleY8mNDxDZSjJL8kiXlbUUH%2Bg%3D%3D'
# #
# # #ERROR:ssl
# # #verify=False可以忽略证书错误
# # json_data = requests.get(url=url,headers=headers,verify=False).json()
# # print(json_data) #爬取抖音短视频:滑动到某一个视频,然后进入该视频作者的主页,抓取主页中所有的视频数据
#1.在fillder中需要捕获到api.amemv开头的数据包,(提取url然后将fiddler中所有的请求头信息进行携带然后对该url进行请求发送)这个数据包响应回来的是一组json数据,在json数据中以v9为关键字进行搜索,只要携带v9的url都是你要爬取的视频对应的url