var token="AAAAAAAAAAAAAAAAAAAAABXesyegAAAAAA2mJuTUyoBiQiFqw9KIVwOZPoELi/N=djisfUIdUdIiIsU1ILUxIUI2UdIUIUuilljle0yH1LL232X";
var clip=global('CLIP') var idpatt=/\d{19}/; var id=idpatt.exec(clip); var url="https://api.twitter.com/1.1/statuses/show.json?id=" + id[0] + "&tweet_mode=extended";
functiongethttp(url,token) { var xhr = newXMLHttpRequest(); xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { //flash("成功获取数据");//显示返回消息,可删除本行 } }); xhr.open("GET", url, false); xhr.setRequestHeader("Authorization", "Bearer " + token); xhr.send(); return xhr.responseText; }
var json=JSON.parse(gethttp(url));
var variants=json.extended_entities.media[0].video_info.variants;
var max=0; var videourl;
for (var i=0;i<variants.length;i++){
var bitrate=variants[i].bitrate if(bitrate){ if(bitrate>max){ max=bitrate; videourl=variants[i].url }