o618
V2EX  ›  问与答

怎么让python的程序支持虾米音乐链接解析播放?

  •  
  •   o618 · Feb 6, 2014 · 3223 views
    This topic created in 4480 days ago, the information mentioned may be changed or developed.
    弄了一晚上还是不行,代码如下:
    content = re.sub(r'http://www.xiami.com/song/(\w+)', r'<embed src="http://xiami.com/widget/0_\1/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed>', content)
    return content
    4 replies    1970-01-01 08:00:00 +08:00
    faceair
        1
    faceair  
       Feb 6, 2014
    大哥。。你应该是去抓音乐的api吧,你怎么好像是想让python解析flash
    faceair
        2
    faceair  
       Feb 6, 2014
    <embed src="http://www.xiami.com/widget/55712_1770016497/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"/>

    主要参数时是这两个,55712_1770016497,前一个是歌手ID,后一个是歌曲ID。
    liyangjie
        3
    liyangjie  
       Feb 6, 2014
    如果是要获得虾米歌曲的真实地址可以参考:https://github.com/liyangjie/xiami-downloader/blob/master/xiami.py
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5462 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 08:48 · PVG 16:48 · LAX 01:48 · JFK 04:48
    ♥ Do have faith in what you're doing.