1
dorentus 2014-01-03 20:20:33 +08:00 1
> xmlReq.setRequestHeader("Refer", "http://www.sostart.com/");
Refer -> Referer HTTP referrer header 的名字是 Referer。 |
2
9hills 2014-01-03 20:28:10 +08:00 1
要注意cookie,我用Python && requests库给你一个example
import requests s=requests.Session() s.headers.update({'Referer': 'http://www.sostart.com/'}) s.headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36'}) # 保存cookie到session中 r1=s.get('http://www.sostart.com') import time r2=s.get("http://www.sostart.com/api.php?_={}".format(int(time.time())*1000)) print r2.json() Out: [{u'album': u'Origin', u'artist': u'Evanescence', u'cover': u'http://img3.douban.com/lpic/s2362221.jpg', u'id': u'449', u'source': u'http://sostartradio-songs.stor.sinaapp.com/201307/449.mp3', u'title': u'My Immortal'}, ... |