工具:
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="//img.ddtbk.com/d/file/p/2022/11/16/22/wKgDs1QO0hHBaryDAAGRHqUnuE4210.jpg",
"cover_url_142":"//img.ddtbk.com/d/file/p/2022/11/16/22/wKgDs1QO0hHBaryDAAGRHqUnuE4210_web_large.jpg",
"formatted_created_at":"9">http://fdfs.xmcdn.com/group4/M07/03/E1/wKgDs1QO0hHBaryDAAGRHqUnuE4210.jpg",
"cover_url_142":"//img.ddtbk.com/d/file/p/2022/11/16/22/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、一切就是那么简单!