-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyinyuetai.js
More file actions
101 lines (80 loc) · 2.19 KB
/
Copy pathyinyuetai.js
File metadata and controls
101 lines (80 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
function loadScript(url, callback) {
var script = document.createElement("script");
script.type ="text/javascript";
// IE
if (script.readyState) {
script.onreadystatechange = function () {
if (script.readyState =="loaded"|| script.readyState =="complete") {
script.onreadystatechange = null;
callback();
}
};
} else { // others
script.onload = function () {
callback();
};
}
script.src = url;
document.body.appendChild(script);
}
function is_yinyuetai(url) {
var urlReg = /(?:yinyuetai.com\/video\/h5\/)(.*)/,
urlReg2 = /(?:yinyuetai.com\/video\/)(.*)/,
match = false;
//prefix = 'http://v.youku.com/player/getPlayList/VideoIDS/';
if (urlReg.test(url)) {
match = urlReg.exec(url);
} else if (urlReg2.test(url)) {
match = urlReg2.exec(url);
} else {
return false;
}
if (match.length === 2) {
return match[1];
} else {
return false;
}
}
function getList(){
var list = new Array();
var host = window.location.protocol +"//"+ window.location.host;
if(window.location.port != '') {
host += ":"+window.location.port;
}
//http://v.yinyuetai.com/video/h5/2508251
var vid = is_yinyuetai(document.URL);
var ts =+ (new Date);
var url = 'http://ext.yinyuetai.com/main/get-h-mv-info?json=true&videoId=' + vid + '&_=' + ts;
$.ajax({
url: url,
dataType: 'JSONP',
success: function(param) {
console.log(param);
var row = param.videoInfo.coreVideoInfo.videoUrlModels[0];
var info ={
isok: true,
url: row.videoUrl,
type:'detail',
};
console.log(info);
if (typeof(WebViewBridgeAndroid) != "undefined" && WebViewBridgeAndroid) {
WebViewBridgeAndroid.send(JSON.stringify(info));
// $("#info").text(JSON.stringify(e));
} else {
console.log("no WebViewBridgeAndroid");
}
},
error: function(param) {
console.log(param);
if (typeof(WebViewBridgeAndroid) != "undefined" && WebViewBridgeAndroid) {
WebViewBridgeAndroid.send(JSON.stringify({type:'detail',isok:false,}));
// $("#info").text(JSON.stringify(e));
} else {
console.log("no WebViewBridgeAndroid");
}
}
});
}
loadScript("http://leapar.github.io/jquery.min.js", function () {
getList();
});