zoukankan      html  css  js  c++  java
  • 08、 寻找周杰伦

         找到周杰伦所有歌曲的  歌曲名、所属专辑、播放时长,播放链接
     
     1 #8 寻找周杰伦
     2 #   找到周杰伦所有歌曲的  歌曲名、所属专辑、播放时长,播放链接
     3 #   URL https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.song&searchid=59511865801247509&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=10&w=%E5%91%A8%E6%9D%B0%E4%BC%A6&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0
     4 
     5 import requests
     6 from bs4 import BeautifulSoup
     7 res = requests.get('https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.song&searchid=59511865801247509&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=10&w=%E5%91%A8%E6%9D%B0%E4%BC%A6&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0')
     8 html = res.json()
     9 music_list = html['data']['song']['list']
    10 total_num = html['data']['song']['totalnum']
    11 total_page = int(total_num / 10) + 1
    12 #print(total_page)
    13 gequid= 0
    14 for pages in range(1,total_page):
    15     res = requests.get('https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.song&searchid=59511865801247509&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p={}&n=10&w=%E5%91%A8%E6%9D%B0%E4%BC%A6&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0'.format(pages))
    16     html = res.json()
    17     music_list = html['data']['song']['list']
    18     for i in range(len(music_list)):
    19         gequid = gequid + 1
    20         print(gequid,end='	')
    21         print(music_list[i]['name'],end='	')
    22         print(music_list[i]['album']['name'],end='	')
    23         print(music_list[i]['interval'],end='	')
    24         print(music_list[i]['url'])
    25 
    26 '''
    27 执行结果如下:
    28 1       晴天    叶惠美  269     http://stream10.qqmusic.qq.com/97773.wma
    29 2       告白气球        周杰伦的床边故事        215     http://stream10.qqmusic.qq.com/107192078.wma
    30 3       稻香    魔杰座  223     http://stream10.qqmusic.qq.com/449205.wma
    31 4       不能说的秘密    不能说的秘密 电影原声带 296     http://stream10.qqmusic.qq.com/403778.wma
    32 5       七里香  七里香  299     http://stream10.qqmusic.qq.com/102065756.wma
    33 6       青花瓷  我很忙  239     http://stream10.qqmusic.qq.com/410316.wma
    34 7       简单爱  范特西  271     http://stream10.qqmusic.qq.com/97744.wma
    35 8       等你下课(with 杨瑞代)   等你下课        270     http://stream10.qqmusic.qq.com/212877900.wma
    36 9       夜曲    十一月的萧邦    226     http://stream10.qqmusic.qq.com/718477.wma
    37 10      彩虹    我很忙  263     http://stream10.qqmusic.qq.com/102340966.wma
    38 
    39 351     布拉格广场      爱的借口(新歌+精选)     301     http://stream10.qqmusic.qq.com/131385.wma
    40 352     龙卷风  地表最强 - 周杰伦       249     http://stream10.qqmusic.qq.com/203466849.wma
    41 353     最长的电影      地表最强 - 周杰伦       238     http://stream10.qqmusic.qq.com/203466850.wma
    42 354     明明就  地表最强 - 周杰伦       259     http://stream10.qqmusic.qq.com/203466848.wma
    43 355     红尘客栈        明日之子 第12期 239     http://stream10.qqmusic.qq.com/203761067.wma
    44 356     黑色幽默        梦想的声音 第4期        290     http://stream10.qqmusic.qq.com/109394038.wma
    45 
    46 '''
     
     
  • 相关阅读:
    POJ 1840 Eqs 二分+map/hash
    【vijos】P1514天才的记忆
    函数介绍
    函数参数和函数返回值
    函数参数和函数返回值
    前端项目里常见的十种报错及其解决办法
    前端项目里常见的十种报错及其解决办法
    BootstrapTable的使用教程
    BootstrapTable的使用教程
    前端js实现打印(导出)excel表格
  • 原文地址:https://www.cnblogs.com/www1707/p/10692375.html
Copyright © 2011-2022 走看看