-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvidto.ts
32 lines (25 loc) · 1.2 KB
/
vidto.ts
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
var http = new XMLHttpRequest();
http.open("GET", url,true);
http.onloadend = function() {
var temp=http.responseText.split('"');
var id=temp[temp.findIndex(x=>x=="id")+2];
var fname=temp[temp.findIndex(x=>x=="fname")+2];
var hash=temp[temp.findIndex(x=>x=="hash")+2];
setTimeout(function() {
http = new XMLHttpRequest();
var data = new FormData();
http.open("POST", url, true);
data.append('op', "download1");
data.append('id', id);
data.append('fname', fname);
data.append('hash', hash);
http.onloadend = function() {
console.log(http.responseText);
var splitted=http.responseText.split('"');
var lnk=splitted[splitted.findIndex(x=>x.endsWith("hq="))+1];
doOnComplete(lnk);
}
http.send(data);
}, 8000);
}
http.send();