When you search for a song on Baidu, you will find that there is a simpler method. Hey hey, it's naive to tell you a secret,
Baidu has an undisclosed API
Http://box.zhangmen.baidu.com/X? OP = 12 & COUNT = 1 & Title = about winter $ Qi Qin $
With the above address, the red part is changed to the song name and author name, and Baidu will give you an XML:
Baidu modified its XML:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Result>
<Count> 1 </count>
<URL>
<Encode>
<! [CDATA [
Http://zhangmenshiting.baidu.com/data2/music/12762804/
Activities $
]>
</Encode>
<Decode>
<! [CDATA [
201762804.mp3? Xcode = ba6c1f8ee7b7a2c90d7b4b9a27aa30f1 & Mid = 0.95489846846986
]>
</Decode>
<Type> 8 </type>
<Lrcid> 14706 </lrcid>
<Flag> 1 </flag>
</URL>
<Durl>
<Encode>
<! [CDATA [
Http://zhangmenshiting2.baidu.com/data2/music/7339015
/Configure
]>
</Encode>
<Decode>
<! [CDATA [
7339015.mp3? Xcode = ba6c1f8ee7b7a2c90d7b4b9a27aa30f1 & Mid = 0.95489846846986
]>
</Decode>
<Type> 8 </type>
<Lrcid> 14706 </lrcid>
<Flag> 1 </flag>
</Durl>
<P2P>
<Hash> c95f9cfadb9ea0235da-75d9efa06673228530b </HASH>
<URL>
<! [CDATA [
Http://zhangmenshiting.baidu.com/data2/music
/8453672/8453672 bytes? Xcode = ba6c1f8ee7b7a2c90d7b4b9a27aa30f1
]>
</URL>
<Type> MP3 </type>
<Size> 3757804 </size>
<Bitrate> 128 </bitrate>
</P2P>
</Result>
This is the music address http://zhangmenshiting.baidu.com/data2/music you want
/8453672/8453672 bytes? Xcode = ba6c1f8ee7b7a2c90d7b4b9a27aa30f1
The value of count is 1, which indicates that one is returned, Which is useless. The following items will be useful,
The value in the encode is the encrypted address of the song,
Encryption is only for file name encryption, we need only the previous path, that is, the http://song.feifa-radio.com/Q/20050701
/Jingxuan/
This part, and then copy the decode value: 1.wma and the previous fight is correct:
The value of type after the http://song.feifa-radio.com/Q/20050701/jingxuan/1.Wma is 2
It indicates that the file type of this song is WMA, and the others are:
1 indicates RM and 0 indicates MP3. Normally, all types are MP3 or WMA,
So if there is 2 or 0 lrcid, the value is the name of the lyrics file of this song on the Baidu server.
The file path is:
Http://box.zhangmen.baidu.com/bdlrc/496/49684.lrc
This address is parsed as follows:
Http://box.zhangmen.baidu.com/bdlrc/ this is Baidu LRC lyrics storage address,
The last 496 is an indefinite one, which means the directories with different songs have different names,
Its algorithm is to take the lyrics file name (that is, 49684 mentioned above)
Divide by one hundred, and then take the largest integer less than or equal to the result, as shown in the following figure:
49684/100 = 496.84 take the largest integer less than or equal to 496.84 is 496, so the complete lyrics of this song come out:
1) http://box.zhangmen.baidu.com/bdlrc/496/49684.lrc
Anning seems so naive and complicated. I hope it will be useful to everyone.
Java code
<Deleetask>
<! -- Search Music address http://cgi.music.soso.com/fcgi-bin/m.q? W = [Song/singer name] & P = [page number] & t = [format] -->
<! -- Format:-1-All 0-mp3 1-rm, 2-wma -->
<Add key = "sosourl" value =
"Http://cgi.music.soso.com/fcgi-bin/m.q? W = {0} & P = 1 & t = {1} "/>
<! -- Baidu music address http://mp3.baidu.com/M? F = Ms & Rf = idx & Tn = baidump3 & Ct =
134217728 & LF = & Rn = & word = [Song/singer name] & lm = [format] & Pg = [page number] -->
<! --- Format:-1-All 0-mp3 1-rm, 2-wma -->
<Add key = "baiduurl" value = "http://mp3.baidu.com/M? F = Ms & Rf = idx & Tn = baidump3 & Ct =
134217728 & LF = & Rn = & word = {0} & lm = {1} "/>
<! -- Baidu music quick search address http://box.zhangmen.baidu.com/X? OP = 12 & COUNT = 1 & Title = [song name] $ [Singer name] $ -->
<Add key = "baiduquickurl" value = "http://box.zhangmen.baidu.com/X? OP = 12 & COUNT = 1 & Title = {0} $ {1} $ "/>
<! -- Brief listen to the lyrics http://ttlrcct.qianqian.com/dll/lyricsvr.dll information address? Sh? Artist = [artist name] & Title = [song name] -->
<Add key = "ttlclisturl" value = "http://ttlrcct.qianqian.com/dll/lyricsvr.dll? Sh? Artist = {0} & Title = {1} "/>
<! -- Just listen to the lyrics http://ttlrccnc.qianqian.com/dll/lyricsvr. dll? DL? Id = [Song id] & code = [title and artist] & uid = 03 &
MAC = 002421585787 & HDS = WD-WMAV22344505 "-->
<Add key = "ttlcurl" value = "http://ttlrccnc.qianqian.com/dll/lyricsvr.dll?
DL? Id = {0} & code = {1} & uid = 03 & MAC = 002421585787 & HDS = WD-WMAV22344505 "/>
</Appsettings>
This great God found http://blog.csdn.net/manbujingxin/article/details/6823187