Repository navigation
Expand file tree
/
Copy pathqq.js
More file actions
83 lines (79 loc) · 2.28 KB
/
Copy pathqq.js
File metadata and controls
83 lines (79 loc) · 2.28 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
console.clear();
var domain = location.host;
console.info(domain);
var dialog = document.getElementById('dialog');
if (dialog == null) {
var dialog = document.createElement('dialog');
dialog.setAttribute('id', 'dialog');
dialog.setAttribute('open', 'open');
dialog.style.width = "50px";
dialog.style.position = 'fixed';
dialog.style.margin = '0px';
dialog.style.top = '100px';
dialog.style.left = '0px';
dialog.style.zIndex = 10000;
document.body.appendChild(dialog);
}
dialog.innerHTML = '';
function xmlHttpRequest(url) {
console.info(url);
console.warn("document.getElementById('dialog') = " + document.getElementById('dialog'));
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
console.info(xhr.responseText);
var data = JSON.parse(xhr.responseText);
}
} else {
console.error(url);
console.error(xhr.responseText);
}
}
xhr.open('GET', url, false);
xhr.send();
}
var videos = document.getElementsByTagName('video');
console.log(videos);
if(videos.length != 0){
dialog.style.display = 'block';
var button = document.createElement('button');
button.textContent = '| X |';
dialog.appendChild(button);
button.onclick = function(){
dialog.style.display = 'none';
}
for(i=0; i<videos.length; i++){
var br = document.createElement('br');
dialog.appendChild(br);
var a = document.createElement('a');
a.textContent = '[' + i + ']';
a.href = videos[i].src;
a.target = "_blank";
dialog.appendChild(a);
}
}else{
var videoId;
var param = document.getElementsByTagName('param');
for (i = 0; i < param.length; i++) {
if (param[i].getAttribute('name') == 'flashvars') {
var flashvars = param[i].getAttribute('value');
console.info(flashvars);
if (flashvars.indexOf('&') != -1) {
var vars = new Array();
vars = flashvars.split('&');
for (j = 0; j < vars.length; j++) {
//console.info(vars[i]);
if (vars[j].indexOf('vid=') != -1) {
videoId = vars[j].substring(4);
console.info(videoId);
var url = 'http://vv.video.qq.com/geturl?vid=' + videoId;
xmlHttpRequest(url);
break;
}
}
break;
}
}
}
}