输入歌手给出前十首歌

#bs4的使用
'''
import re
import requests
from urllib import error
from bs4 import BeautifulSoup
import os
url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp'
list_singer  = input("请输入你所需要十大评论的人名:")
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0",}
singer = list_singer
params = {
        'ct': '24',
        'qqmusic_ver': '1298',
        'new_json': '1',
        'remoteplace': 'txt.yqq.song',
        'searchid': '59258368198185505',
        't': '0',
        'aggr': '1',
        'cr': '1',
        'catZhida': '1',
        'lossless': '0',
        'flag_qc': '0',
        'p': '1',
        'n': '10',
        'w': '',
        'g_tk': '5381',
        'loginUin': '0',
        'hostUin': '0',
        'format': 'json',
        'inCharset': 'utf8',
        'outCharset': 'utf-8',
        'notice': '0',
        'platform': 'yqq.json',
        'needNewCode': '0'
    }
params['w'] = list_singer
res = requests.get(url,params=params,headers = headers)
m_json = res.json()
list_song_name = m_json['data']['song']['list']
#for song in list_song_name:
    #print(song['name'])

'''
posted @ 2020-01-11 19:00  adsry  阅读(173)  评论(0)    收藏  举报