使用python扫描本地音乐并下载歌词

498 查看

这次这个真的是干货哦,昨晚弄了半晚上,从8点吃完饭就开始写,一直到了快12点才弄好,新手伤不起呀。
先简单的说下吧,百度提供了一个音乐搜索的api,你想百度请求类似于
http://box.zhangmen.baidu.com/x?op=12&count=1&title=最佳损友???<br />
?????????????xml?????</p><!-- Crayon Syntax Highlighter v2.7.1.1 -->

		<div id=

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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/12762845/YmRqamdua21fn6NndK6ap5WXcJlrmG1xlJhobWibmGpjk5ZtmWiZcWRjZ5lqbGyelGKWlZtubGljZ5lka2uanWSXY1qin5t1YWBmZW5ocGlhaWdnbGtqbzE$
]]>
</encode>
<decode>
<![CDATA[
12762845.mp3?xcode=e6b69cf593ea22ac9d2b9314e565fc0caf85125f065ce3e0&mid=0.31929107437537
]]>
</decode>
<type>8</type>
<lrcid>2829</lrcid>
<flag>1</flag>
</url>
<durl>
<encode>
<![CDATA[
http://zhangmenshiting2.baidu.com/data2/music/7345405/aGVnaWlmbGaeomZzrZmmnJZvmGqXbHCbl2dsZ5qXaWqSlWpsmmdrb2mXamxpbXCclGNsmW2ba25mYmxtapmZcWqTWaGemnRoX2VkbWdvaGhoZmZramluOA</span></div><div class=]]>
7345405.mp3?xcode=e6b69cf593ea22ac78e1478e78479dc19e8e4650995cb99a&mid=0.31929107437537
]]>
8
2829
1
f98b6772aa97966550ec80617879becee0233bf4
mp3
3778335
128