Last active
December 23, 2015 19:09
-
-
Save lixiaoyan/6680198 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 乐视网 | |
// @match http://www.letv.com/ptv/vplay/* | |
// ==/UserScript== | |
(function(vid){ | |
var list=["720p","350"]; | |
var box=document.querySelector("#fla_box"); | |
var embed=box.querySelector("embed"); | |
box.removeChild(embed); | |
GM_xmlhttpRequest({ | |
method:"GET", | |
url:"http://www.letv.com/v_xml/"+vid+".xml", | |
onload:function(res){ | |
var doc=new DOMParser().parseFromString(res.responseText,"text/xml"); | |
var url=doc.getElementsByTagName("playurl")[0]; | |
var json=JSON.parse(url.textContent); | |
list.some(function(type){ | |
if(json.dispatch[type]){ | |
var vlc=document.createElement("embed"); | |
vlc.src=json.dispatch[type][0]; | |
vlc.type="video/flv"; | |
vlc.style.width="100%"; | |
vlc.style.height="100%"; | |
box.appendChild(vlc); | |
return true; | |
} | |
}); | |
} | |
}); | |
})(unsafeWindow.__INFO__.video.vid); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment