forked from theofficialvkr/VKrDownloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
126 lines (104 loc) · 4.02 KB
/
Copy pathjavascript.js
File metadata and controls
126 lines (104 loc) · 4.02 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//VKrDownloader
let myurl = document.getElementById("inputUrl");
let downloadBtn = document.getElementById("downloadBtn");
downloadBtn.addEventListener("click",()=>{
var myParam = myurl.value;
//Loading
let container = document.getElementById("container");
let loading = document.getElementById("loading");
container.style = "display:block";
loading.style = "display:block";
if(myParam){
$.ajax({
url:"https://vijayapi.000webhostapp.com/api/test.php?vkr="+myParam,
type:"GET",
async:false,
crossDomain:true,
dataType: 'json',
success: function(data){
const obj = data;
loading.style = "display:none";
console.log(obj.title);
// Define
if (!$.trim(data)){
alert("1 - Unable To Get Download Link Please Check URL and Contact us on Social Media @TheOfficialVKr");
}else {
let vidTitle = obj.title;
let vidId = obj.id;
let vidThumb = obj.thumbnail;
let vidDescription = obj.description;
let vidUploader = obj.uploader;
let vidDuration = obj.duration;
let vidExtractor = obj.extractor;
let vidUrl = obj.url;
let thumbV = document.getElementById("thumb");
let titleV = document.getElementById("title");
let descriptionV = document.getElementById("description");
let uploaderV = document.getElementById("uploader");
let durationV = document.getElementById("duration");
let extractorV = document.getElementById("extractor");
let urlV = document.getElementById("downloadURL");
let downloadV = document.getElementById("download");
// Checking That Object is Exist Or Not
if(vidThumb)
{
thumbV.innerHTML = "<img src='"+vidThumb+"' width='300px'>";
}else {
thumbV.innerHTML = "<img src='logo.png' width='300px'>";
}
if(vidTitle)
{
titleV.innerHTML = "<h1>"+vidTitle+"</h1>";
}
if(vidDescription)
{
descriptionV.innerHTML = "<h3><details> <summary>View Description</summary>"+vidDescription+"</details></h3>";
}
if(vidUploader)
{
uploaderV.innerHTML = "<h5>"+vidUploader+"</h5>";
}
if(vidDuration)
{
durationV.innerHTML = "<h5>"+vidDuration+"</h5>";
}
if(vidExtractor)
{
extractorV.innerHTML = "<h5>"+vidExtractor+"</h5>";
}
if(vidUrl)
{
urlV.innerHTML = "";
urlV.innerHTML = "<a href='"+vidUrl+"'><button class='dlbtn'>Video</button></a>";
}
if(obj.entries)
{
urlV.innerHTML = "";
urlV.innerHTML += "<a href='"+obj.entries[0].url+"'><button class='dlbtn'>Download Video</button></a>";
}
else if(obj.formats)
{
downloadV.innerHTML = "";
for (var i = 0; i< obj.formats.length; i++)
{
downloadV.innerHTML += "<a href='"+obj.formats[i].url+"'><button class='dlbtns'>"+obj.formats[i].format + "</button></a>";
}
}
else if(obj.medias)
{
downloadV.innerHTML = "";
for (var i = 0; i< obj.medias.length; i++)
{
downloadV.innerHTML += "<a href='"+obj.medias[i].url+"'><button class='dlbtns'>"+obj.medias[i].quality + "</button></a>";
}
}
else
{
alert("2 -Server Down due to Too Many Requests please Contact us on Social Media @TheOfficialVKr");
container.style = "display:none";
location.href="http://theofficialvkr.ml/download.php?vkr="+myParam;
}
}
}})
}
});