Python 爬取百度音乐
来源:互联网 发布:计算机编程入门书籍 编辑:程序博客网 时间:2024/05/16 23:45
Python:3.5
欢迎加入学习交流QQ群:657341423
获取歌曲信息
post方式
import requestsurl='http://play.baidu.com/data/music/songlink'data={'songIds':'100575177'}r=requests.post(url,data=data)print (r.content.decode('UTF-8'))f=open('data.txt','w',encoding='utf-8')f.write(r.content.decode('UTF-8'))f.close()
通过获取songIds即可获得歌曲的信息
get方式
http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.song.play&format=jsonp&songid=2498009
同样通过获取songIds即可获得歌曲的信息
爬取百度MV
import requestsurl='http://music.baidu.com/playmv/554869244's=requests.session()headers={'referer':'http://music.baidu.com/mv', 'user-agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36', }r=s.get(url,headers=headers)a=r.content.decode('UTF-8')file_mp4=a.split('data.push')[1].split('file_link":"')[1].replace('"});','').replace(r"\\",r'').replace('\/','/').replace("\n",'').strip()get_file=s.get(file_mp4)f=open('data.mp4','wb')f.write(get_file.content)f.close()
阅读全文
0 0
- Python-爬取百度音乐
- Python 爬取百度音乐
- python爬虫之爬取百度音乐
- python爬虫之爬取百度音乐
- python爬取落网音乐
- 偷取百度音乐。。。
- python爬取百度音乐(二)——保存数据到mysql中
- Python 爬取百度图片
- python爬取百度图片
- Python爬取百度图片
- python爬取百度百科
- python爬取百度图片
- Python 爬取百度图片
- Python爬取百度图片
- [python爬虫]--爬取豆瓣音乐topX
- [python爬虫]--爬取豆瓣音乐topX
- 利用python爬取豆瓣音乐TOP250
- python 下载百度音乐
- 基于restful服务端接口(二)
- 将自己的数据集制作成TFRecord格式
- Unity3D-塔防游戏项目主要源码(防御塔炮弹脚本)
- html+css学习心得(2)
- Sequence
- Python 爬取百度音乐
- Server Tomcat v8.0 Server at localhost failed to start.
- 【知了堂学习笔记】eclipse常见问题和基本设置
- 设计模式-抽像工厂
- 比特币源码解析(11)
- 导入maven项目报错
- 3380: [Usaco2004 Open]Cave Cows 1 洞穴里的牛之一
- 3144: [Hnoi2013]切糕
- VMware中解决ubuntu不能连接网络问题。(亲测有效)