#-*-coding:utf-8-*- __author__ = 'qinlan' import requests import time,os,random,re,json from multiprocessing import Pool keyword = 'Linkin Park' proxies = [ '115.224.163.58:61202','179.184.9.172:20183', '177.37.166.164:20183','103.55.69.242:53281', '217.61.106.183:80','45.125.220.242:8080', '103.88.140.85:8080','218.26.227.108:80', '110.171.230.47:8080','118.81.108.77:9797', '31.145.83.198:8080','195.88.208.115:3128' ] agent = [ 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24' ] headers = { 'referer':'https://y.qq.com/portal/search.html', 'User-Agent':random.choice(agent) } session = requests.Session() def parseMainHtml(page): base_url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp?' params = { #URL可变参数如下
python爬虫(qq音乐)
最新推荐文章于 2024-09-03 16:47:21 发布
该博客演示了如何使用Python进行QQ音乐的爬虫实现,通过多进程Pool下载Linkin Park的歌曲。首先定义代理、User-Agent等请求头,然后获取搜索结果页面,解析音乐链接并下载MP3文件。主要涉及requests库、正则表达式和JSON解析。
摘要由CSDN通过智能技术生成