V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
PeterD
V2EX  ›  问与答

虾米高品质音乐接口不返回 XML 了,现在返回二进制码,大神们,何解?

  •  
  •   PeterD · Mar 7, 2014 · 3877 views
    This topic created in 4435 days ago, the information mentioned may be changed or developed.
    虾米高品质音乐接口: http://www.xiami.com/song/gethqsong/sid/{songid}
    ----------

    3月5日前接口返回XML,可用凯撒矩阵得到url,现在返回二进制码了,大神们,如何从其得到url。
    ----------

    下面的代码可以取得接口返回的二进制码:
    1. 不用member_auth

    curl -s -H 'Referer: http://img.xiami.net/static/swf/seiya/player.swf?v=1394176529254' -H 'User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4,zh-TW;q=0.2' http://www.xiami.com/song/gethqsong/sid/1

    2. 用member_auth(需要vip账号)

    curl -s -H 'Cookie: member_auth=' -H 'Referer: http://img.xiami.net/static/swf/seiya/player.swf?v=1394176529254' -H 'User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4,zh-TW;q=0.2' http://www.xiami.com/song/gethqsong/sid/1

    --------------
    header中Referer是一定要的,不然返回404.
    2 replies    1970-01-01 08:00:00 +08:00
    PeterD
        1
    PeterD  
    OP
       Mar 7, 2014
    刚才用thunar看了是一个gzip,哈哈
    jacy
        2
    jacy  
       Mar 12, 2014
    木有问题,我做的程序正常5istar.net/xiami/
    抓个包,加了个referrer就好了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3302 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 13:27 · PVG 21:27 · LAX 06:27 · JFK 09:27
    ♥ Do have faith in what you're doing.