91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .py
    金幣: 1
    下載: 1 次
    發布日期: 2021-07-01
  • 語言: Python
  • 標簽: python??music??

資源簡介

python下載音樂源代碼,輸入你想要下載的歌手的名字,你就可以下載

資源截圖

代碼片段和文件信息

import?requests
import?re
import?json
import?os



def?get_name(singer):
????url?=?‘https://c.y.qq.com/soso/fcgi-bin/client_search_cp‘
????params?=?{
????????‘catZhida‘:?‘1‘
????????‘w‘:?singer
????}
????headers?=?{
????????‘referer‘:?‘https://y.qq.com/portal/search.html‘
????????‘user-agent‘:?‘Mozilla/5.0?(Windows?NT?10.0;?Win64;?x64)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/66.0.3359.139?Safari/537.36‘
????}
????html?=?requests.get(urlheaders=headersparams=params).text
????content?=?re.compile(‘callback\((.*)\)‘).findall(html)[0]
????content?=?json.loads(content)
????data?=?content.get(‘data‘)
????song?=?data.get(‘song‘)
????lists?=?song.get(‘list‘)
????name?=?[]
????for?list?in?lists:
????????singer?=?list.get(‘singer‘)[0].get(‘mid‘)
????????name.append(singer)
????name?=?name[0]
????return?name

def?get_html(namesinger):
????url?=?‘https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg‘
????params?=?{
????????‘singermid‘:?name
????????‘order‘:?‘listen‘
????????‘begin‘:?‘0‘
????????‘num‘:?‘10‘
????}
????headers?=?{
????????‘referer‘:?‘https://y.qq.com/n/yqq/singer/003aQYLo2x8izP.html‘
????????‘user-agent‘:?‘Mozilla/5.0?(Windows?NT?10.0;?Win64;?x64)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/66.0.3359.139?Safari/537.36‘
????}
????html?=?requests.get(urlheaders=headersparams=params).text
????return?html


def?get_music(vkeysongnamefilenamesinger):
????if?vkey?and?songname:
????????url3?=?‘http://dl.stream.qqmusic.qq.com/‘?+?filename?+?‘?vkey=‘?+?vkey?+?‘&guid=7133372870&uin=0&fromtag=66‘

????????headers?=?{
????????????‘referer‘:?‘https://y.qq.com/n/yqq/singer/003aQYLo2x8izP.html‘
????????????‘user-agent‘:?‘Mozilla/5.0?(Windows?NT?10.0;?Win64;?x64)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/66.0.3359.139?Safari/537.36‘
????????}
????????music?=?requests.get(url3headers=headers).content
????????dir?=?singer
????????if??not?os.path.exists(dir):
????????????os.mkdir(dir)
????????with?open(dir+‘/‘+songname+‘.m4a‘‘wb‘)?as?f:
????????????f.write(music)
????????print(songname‘__‘singer)

d

評論

共有 條評論