博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
百度音乐Api简单简单实用实例及封装
阅读量:4287 次
发布时间:2019-05-27

本文共 1565 字,大约阅读时间需要 5 分钟。

一、搜索歌曲API

http:
//musicmini.baidu.com/app/search/searchList.php?qword={0}&ie=utf-8&page={1}
 
{0}=需要搜索的歌曲或歌手
 
{1}=页码数(第一页就是0,第二页是1)
返回的是一个html网页,需要分析网页,得到歌曲ID,歌曲名,歌手,专辑等 属性

二、获取歌曲详细信息API

http:
//ting.baidu.com/data/music/links?songIds={0}
 
{0}=从上面的结果的中分析的歌曲的ID
返回Json数据,歌曲的详细信息:

{    "SongID": "14795583",    "SongName": "海阔天空",    "ArtistID": "82367",    "ArtistName": "黄家驹",    "AlbumID": "14686304",    "AlbumName": "来自天堂的声音-黄家驹",    "SongPicSmall": "http://musicdata.baidu.com/data2/pic/4ee18a5c97435ff5c883b25d9960c0af/262388741/262388741.jpg",    "SongPicBig": "http://musicdata.baidu.com/data2/pic/b8aecedd9f9ca87f6298d76c8e1b73de/262388734/262388734.jpg",    "SongPicRadio": "",    "LrcLink": "http://musicdata.baidu.com/data2/lrc/d8e0550f18cebfebc6cbc30379ac9b64/262236886/262236886.lrc",    "Version": "混音",    "Time": 322,    "LinkCode": "22000",    "SongLink": "http://file.qianqian.com//data2/music/120871889/120871889.mp3?xcode=ce20e423fde9a5850c0d8753917afb85&src=\"http%3A%2F%2Fpan.baidu.com%2Fshare%2Flink%3Fshareid%3D551361339%26uk%3D1079230802\"",    "ShowLink": "http://pan.baidu.com/share/link?shareid=551361339&uk=1079230802",    "Format": "mp3",    "Rate": "128",    "Size": 5162937,    "RelateStatus": "0",    "ResourceType": "2",    "Source": "web"}

里面有歌曲图片,歌曲地址,歌词地址
 
歌曲地址里如果有http:
//qukufile2.qianqian.com/data2/pic/和http://c.hiphotos.baidu.com/ting/pic/item/ 那就需要将http://c.hiphotos.baidu.com/ting/pic/item/给去掉
 
歌词地址:http:
//qukufile2.qianqian.com+获取到的url
三、常用逻辑封装如下:

使用到两个重要工具

1.Json序列化工具Newtonsoft.Json

2.Html解析工具:HtmlAgilityPack

源代码参考

参考文章:

转载地址:http://dbogi.baihongyu.com/

你可能感兴趣的文章
论文笔记 | Leveraging Graph to Improve Abstractive Multi-Document Summarization
查看>>
NAACL2021丨Knowledge Guided Metric Learning for Few-Shot Text Classification
查看>>
论文笔记|Deep Open Intent Classification with Adaptive Decision Boundary
查看>>
【论文笔记】
查看>>
论文笔记_Pay Attention to MLPs
查看>>
【论文笔记】
查看>>
论文笔记
查看>>
论文笔记 | Attention-based LSTM for Aspect-level Sentiment Classification
查看>>
【论文笔记】Joint Extraction of Entities and Relations Based on a Novel Tagging Scheme
查看>>
论文笔记|Bidirectional LSTM-CRF Models for Sequence Tagging
查看>>
论文笔记:Constructing Narrative Event Evolutionary Graph for Script Event Prediction
查看>>
论文笔记: Hierarchical Chinese Legal event extraction via Pedal Attention Mechanism
查看>>
论文笔记 | Enhancing Pre-Trained Language Representations with Rich Knowledge for MRC
查看>>
论文笔记 | Text Summarization with Pretrained Encoders
查看>>
论文笔记:Document-level Event Extraction via Heterogeneous Graph-based Interaction Model with a Tracker
查看>>
论文笔记丨Inductive Unsupervised Domain Adaptation for Few-Shot Classification via Clustering
查看>>
论文笔记|GSum: A General Framework for Guided Neural Abstractive Summarization
查看>>
论文笔记 | Does Structure Matter? Encoding Documents for Machine Reading Comprehension
查看>>
论文笔记|Self-Supervised Test-Time Learning for Reading Comprehension
查看>>
论文笔记|Open-world Learning and Application to Product Classification
查看>>