本文的文字及图片来源于网络,仅供学习、交流使用,不具备任何商业用途,若有问题请及时联系咱们以做处理。css
打开开发者工具分析网页python
你怎么知道这个就是下载地址呢?网络
一、选择一个应用的下载地址
二、打开开发者工具,清空数据,选择Network
三、点击当即下载
四、就会发现下载地址app
把连接地址复制,在网页源代码中搜索,查看是否网页是否有返回该数据工具
import requests import parsel def download(url, title): path = 'D:\\python\\demo\\应用宝手机APP软件\\APP软件\\' + title + '.apk' response = requests.get(url=url, headers=headers) with open(path, mode='wb') as f: f.write(response.content) for page in range(100, 123): url = 'https://sj.qq.com/myapp/category.htm?orgame=1&categoryId={}'.format(page) headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' } response = requests.get(url=url, headers=headers) selector = parsel.Selector(response.text) lis = selector.css('.main ul li') for li in lis: title = li.css('.app-info-desc a:nth-child(1)::text').get() apk_url = li.css('.app-info-desc a:nth-child(4)::attr(ex_url)').get() print(title, apk_url) download(apk_url, title)