PYTHON解析BAIDU的MP3列表
来源:互联网 发布:淘宝延长收货是几天啊 编辑:程序博客网 时间:2024/05/15 10:00
1 运行wget -i Baidump3URL.txt
2 运行BaiduMp3.py> baidump3.txt
3 运行del *.htm?
获得baidu所有歌曲的名字列表
Baidump3URL.txt:
http://list.mp3.baidu.com/song/A.htm
http://list.mp3.baidu.com/song/B.htm
http://list.mp3.baidu.com/song/C.htm
http://list.mp3.baidu.com/song/D.htm
http://list.mp3.baidu.com/song/E.htm
http://list.mp3.baidu.com/song/F.htm
http://list.mp3.baidu.com/song/G.htm
http://list.mp3.baidu.com/song/H.htm
http://list.mp3.baidu.com/song/J.htm
http://list.mp3.baidu.com/song/K.htm
http://list.mp3.baidu.com/song/L.htm
http://list.mp3.baidu.com/song/M.htm
http://list.mp3.baidu.com/song/N.htm
http://list.mp3.baidu.com/song/O.htm
http://list.mp3.baidu.com/song/P.htm
http://list.mp3.baidu.com/song/Q.htm
http://list.mp3.baidu.com/song/R.htm
http://list.mp3.baidu.com/song/S.htm
http://list.mp3.baidu.com/song/T.htm
http://list.mp3.baidu.com/song/W.htm
http://list.mp3.baidu.com/song/X.htm
http://list.mp3.baidu.com/song/Y.htm
http://list.mp3.baidu.com/song/Z.htm
BaiduMp3.py:
#!/usr/bin/pythonimport urllibimport stringimport redef GetContent (url): try: URLFile=urllib.urlopen(url) except IOError: print "\nCan not retrieve ",url,"!\nThe connection cannot be made!\n" else: HTMLText=URLFile.read() URLFile.close() return HTMLTextif(__name__=="__main__"): file=open('Baidump3URL.txt','r') fileread=file.read() urls=fileread.split('\n') queue=[] # regexp=re.compile(r'" target=_blank>(.*?)</[aA]></td>') for url in urls: #print url url=re.sub('http://list.mp3.baidu.com/song','.',url) #print url content=open(url,'r').read() lines=content.split('\n') for line in lines: #print line ccc=regexp.search(line) if(ccc): word=ccc.groups()[0] if word in queue: pass else: queue.append(word) #print url file.close() regexp1=re.compile(r'[- ](.*)') for w in queue: w = unicode(w,'cp936') w = w.encode('utf8') ccc=regexp1.search(w) if(ccc): w=ccc.groups()[0] #print w w=re.sub('《|》|,|\.|·|!','',w) if(''==w): continue print w
- PYTHON解析BAIDU的MP3列表
- python的列表解析
- python的列表解析
- 用python写的一个mp3的tag解析
- MP3的ID3解析
- MP3音频的解析
- MP3的ID3解析
- mp3搜索引擎--算法【baidu】
- 使用.net里的WebClient自动下载baidu的mp3
- C++解析Python返回的列表
- PYTHON-嵌套列表list的解析学习
- 【python】对列表的过滤, 列表解析,生成器表达式
- 文件格式解析:mp1/mp2/mp3 解码(Python)
- 百度mp3接口(baidu mp3 api)
- MP3 lrc文件的解析
- MP3文件格式的解析一
- Python 列表解析
- python 列表解析
- V4L2驱动的移植与应用(三)
- word-spacing
- java中判断字符串是否为数字的三种方法
- ORA-14038: GLOBAL partitioned index must be prefixed
- android 通过电话号码来获取联系人姓名
- PYTHON解析BAIDU的MP3列表
- STL stable_sort 稳定排序
- 内存泄露分析方法(android内存溢出)
- Android 跳转到通话记录详情页
- 由电闸跳闸 厕所停水 想到的。
- 三次握手
- OCP-1Z0-053-V13.02-45题
- 我在敲代码的过程中使用的工具
- wprintf 中使用%I64d格式化输出LONGLONG