工具:
Chrome 浏覽器
過程:
1、打開Chrome 按F12。會彈出 Developer Tools 窗口。點擊 NetWork ,觀察訪問的網頁情況。
2、打開網頁:
http://www.ximalaya.com/#/1000202/sound/3613735,點擊播放按鈕,開始播放音頻。
3、此時在 NetWork 輸出窗口裡會看到各種信息其中有這麼一條訪問記錄
http://www.ximalaya.com/tracks/3613735.json
其返回結果是
代碼如下:
{"id":3613735,"play_path_64":"group4/M08/03/E0/wKgDs1QO0b2jRtupAchYxtSl18g572.mp3",
"play_path_32":"group4/M07/03/E0/wKgDs1QO0eaSYVN0AOQsfXNp6nQ890.mp3",
"play_path_128":null,"play_path":"group4/M0A/03/E0/wKgDs1QO0Wjj8YNaBVkpgPW3Atw003.mp3",
"duration":"3738.72","title":"2010高清 婚姻與家庭(郭德綱 於謙)","nickname":"郭德綱相聲","uid":1000202,"waveform":"group4/M08/07/5B/wKgDtFQO0dCjmub2AAAIhDD3SF43160.js",
"upload_id":"u_3576599","cover_url":"<a href="http://fdfs.xmcdn.com/group4/M07/03/E1/wKgDs1QO0hHBaryDAAGRHqUnuE4210.jpg",
"cover_url_142":"http://fdfs.xmcdn.com/group4/M07/03/E1/wKgDs1QO0hHBaryDAAGRHqUnuE4210_web_large.jpg",
"formatted_created_at":"9">http://fdfs.xmcdn.com/group4/M07/03/E1/wKgDs1QO0hHBaryDAAGRHqUnuE4210.jpg",
"cover_url_142":"http://fdfs.xmcdn.com/group4/M07/03/E1/wKgDs1QO0hHBaryDAAGRHqUnuE4210_web_large.jpg",
"formatted_created_at":"9</a>月9日 18:10","is_favorited":null,"play_count":27466,"comments_count":49,"shares_count":16,"favorites_count":290,
"album_id":276111,"album_title":"郭德綱相聲十年經典之五","intro":"郭德綱相聲十年經典之五","short_intro":"郭德綱相聲十年經典之五","have_more_intro":false,"time_until_now":"16小時前","category_name":"news","category_title":"最新資訊","played_secs":null}
4、而在後面的記錄裡緊跟著是
http://fdfs.xmcdn.com/group4/M08/03/E0/wKgDs1QO0b2jRtupAchYxtSl18g572.mp3
這就是真正的 Mp3地址了。
總結:
1、請求 http://www.ximalaya.com/tracks/ID.json
2、根據結果裡的“play_path_64” 字段使用域名“http://fdfs.xmcdn.com/”拼接得到:http://fdfs.xmcdn.com/group4/M08/03/E0/wKgDs1QO0b2jRtupAchYxtSl18g572.mp3
3、OK!得到 http://fdfs.xmcdn.com/group4/M08/03/E0/wKgDs1QO0b2jRtupAchYxtSl18g572.mp3。
4、一切就是那麼簡單!