-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
176 lines (130 loc) · 3.85 KB
/
index.html
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<style>
.center-div {
width: 1000px;
height:1000px;
}
.div {
width: 500px;
height: 390px;
color: black;
margin-left: 500px;
position: relative;
top:250px;
background: rgba(255,255,255,.05);
box-shadow: 0 0 10px rgba(0,0,0,0.25);
backdrop-filter: blur(20px);
border-radius: 8px;
}
.div:hover {
transform: scale(1.04) ;
}
body {
background-image: url("https://img.freepik.com/free-photo/pile-3d-play-button-logos_1379-880.jpg?w=1480&t=st=1681750818~exp=1681751418~hmac=bc02fc6e3fa2340ad3cd20d36065b8df42ba97b9f80a098232a97f9ac542f9c0");
overflow: hidden;
background-repeat: no-repeat;
background-size: 105%;
}
#fname {
margin-top: 100px;
margin-left: 100px;
padding: 10px;
width: 300px;
border-radius: 5px;
border: 1px solid black;
-webkit-transition: all 0.30s ease-in-out;
outline: none;
}
#fname:focus , #sname:focus {
box-shadow: 0 0 5px rgba(81, 203, 238, 1);
border: 1px solid rgba(81, 203, 238, 1);
}
#sname {
margin-top: 40px;
margin-left: 100px;
padding: 10px;
width: 300px;
border-radius: 5px;
border: 1px solid black;
-webkit-transition: all 0.30s ease-in-out;
outline: none;
}
#submit {
margin-top: 40px;
margin-left: 200px;
padding: 10px;
width: 100px;
border-radius: 5px;
border: none;
background-color: dodgerblue;
color: white;
}
#submit:hover {
transform: scale(1.02);
}
#percentage {
margin-top: 60px;
position: relative;
top:30px;
color:white;
margin-left: 220px;
font-family: sans-serif;
font-size: 18px;
font-weight: bold;
}
.start-h1 {
text-align: center;
position: relative;
top:80px;
color: white;
font-family: sans-serif;
font-size: 20px;
}
</style>
<div class="center-div">
</div>
<script>
let div;
div = document.createElement("div");
div.setAttribute("class","div");
div.innerHTML = `
<h1 class="start-h1">Youtube Video To Mp3 Converter</h1>
<input type="text" id="fname" placeholder="Enter Any Youtube Video Link">
<button id="submit">Submit</button>
<a id="percentage" target="_blank">Get Link</a>
`;
document.querySelector(".center-div").append(div);
let button = document.getElementById("submit");
button.addEventListener("click",(event) => {
event.preventDefault();
let fname = document.getElementById("fname").value;
console.log(fname);
const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': '0dbd38fc8dmsh7004146a64a1761p17226ejsnceab381ff0ef',
'X-RapidAPI-Host': 'youtube-mp3-downloader2.p.rapidapi.com'
}
};
let url = `https://youtube-mp3-downloader2.p.rapidapi.com/ytmp3/ytmp3/?url=${fname}`;
let x;
fetch(url, options)
.then(response => response.json())
.then(response => {
console.log(response)
x = response.links;
document.getElementById("percentage").href = x;
})
.catch(err => console.error(err));
});
</script>
</body>
</html>