Spaces:
Running
Running
Delete api.html
Browse files
api.html
DELETED
@@ -1,283 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<meta charset="UTF-8" />
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
-
<title>PYTR</title>
|
7 |
-
<meta name="title" content="Python YouTube Ringtones" />
|
8 |
-
<meta name="description" content="Generate custom ringtones from YouTube videos with one click! Python YouTube Ringtones lets you convert YouTube audio into high-quality MP3 and iPhone ringtones in seconds. No software required β fast, free, and online!" />
|
9 |
-
<meta property="og:type" content="website" />
|
10 |
-
<meta property="og:url" content="https://ringtones.jessejesse.xyz" />
|
11 |
-
<meta property="og:title" content="Python YouTube Ringtones" />
|
12 |
-
<meta property="og:description" content="Generate custom ringtones from YouTube videos with one click! Python YouTube Ringtones lets you convert YouTube audio into high-quality MP3 and iPhone ringtones in seconds. No software required β fast, free, and online!" />
|
13 |
-
<meta property="og:image" content="https://ringtones.jessejesse.xyz/og.png" />
|
14 |
-
<meta property="twitter:card" content="summary_large_image" />
|
15 |
-
<meta property="twitter:url" content="https://ringtones.jessejesse.xyz" />
|
16 |
-
<meta property="twitter:title" content="Python YouTube Ringtones" />
|
17 |
-
<meta property="twitter:description" content="Generate custom ringtones from YouTube videos with one click! Python YouTube Ringtones lets you convert YouTube audio into high-quality MP3 and iPhone ringtones in seconds. No software required β fast, free, and online!" />
|
18 |
-
<meta property="twitter:image" content="https://ringtones.jessejesse.xyz/og.png" />
|
19 |
-
<meta name="author" content="JesseJesse.xyz" />
|
20 |
-
|
21 |
-
<!-- Web App Manifest -->
|
22 |
-
<link rel="manifest" href="/manifest.json" />
|
23 |
-
|
24 |
-
<!-- Icons -->
|
25 |
-
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
26 |
-
<link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16 32x32" />
|
27 |
-
<link rel="icon" href="/icon-192.png" type="image/png" sizes="192x192" />
|
28 |
-
<link rel="icon" href="/icon-512.png" type="image/png" sizes="512x512" />
|
29 |
-
<link rel="icon" href="/icon-192-maskable.png" type="image/png" sizes="192x192" purpose="maskable" />
|
30 |
-
<link rel="icon" href="/icon-512-maskable.png" type="image/png" sizes="512x512" purpose="maskable" />
|
31 |
-
|
32 |
-
<!-- Theme Colors -->
|
33 |
-
<meta name="theme-color" content="#1a1a2e" />
|
34 |
-
|
35 |
-
<!-- App Manifest Settings -->
|
36 |
-
<meta name="application-name" content="Python YouTube Ringtones" />
|
37 |
-
<meta name="short_name" content="YT Ringtones" />
|
38 |
-
<meta name="description" content="Generate custom ringtones from YouTube videos with one click! Python YouTube Ringtones lets you convert YouTube audio into high-quality MP3 and iPhone ringtones in seconds. No software required β fast, free, and online!" />
|
39 |
-
<meta name="start_url" content="/" />
|
40 |
-
<meta name="display" content="standalone" />
|
41 |
-
<meta name="background_color" content="#111827" />
|
42 |
-
<meta name="orientation" content="portrait" />
|
43 |
-
|
44 |
-
<!-- Tailwind CSS -->
|
45 |
-
<script src="https://cdn.tailwindcss.com"></script>
|
46 |
-
|
47 |
-
<script>
|
48 |
-
document.addEventListener("DOMContentLoaded", () => {
|
49 |
-
updateRingtoneCount();
|
50 |
-
});
|
51 |
-
</script>
|
52 |
-
|
53 |
-
<style>
|
54 |
-
@keyframes glow {
|
55 |
-
0% {
|
56 |
-
border-color: #4f46e5;
|
57 |
-
}
|
58 |
-
50% {
|
59 |
-
border-color: #fbbf24;
|
60 |
-
}
|
61 |
-
100% {
|
62 |
-
border-color: #4f46e5;
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
.glow-border {
|
67 |
-
animation: glow 1.5s ease-in-out infinite;
|
68 |
-
}
|
69 |
-
</style>
|
70 |
-
</head>
|
71 |
-
|
72 |
-
<body
|
73 |
-
style="
|
74 |
-
background: linear-gradient(to bottom right, #1f2937, #374151, #111827);
|
75 |
-
color: white;
|
76 |
-
display: flex;
|
77 |
-
flex-direction: column;
|
78 |
-
justify-content: center;
|
79 |
-
align-items: center;
|
80 |
-
height: 100vh;
|
81 |
-
margin: 0;
|
82 |
-
"
|
83 |
-
>
|
84 |
-
<div
|
85 |
-
id="ringtone-container"
|
86 |
-
style="
|
87 |
-
width: 100%;
|
88 |
-
max-width: 400px;
|
89 |
-
background: transparent;
|
90 |
-
border: 2px solid transparent;
|
91 |
-
border-radius: 8px;
|
92 |
-
padding: 24px;
|
93 |
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
94 |
-
text-align: center;
|
95 |
-
"
|
96 |
-
>
|
97 |
-
<img
|
98 |
-
src="icon.png"
|
99 |
-
alt="App Icon"
|
100 |
-
style="width: 120px; height: 120px; margin-bottom: 20px"
|
101 |
-
/>
|
102 |
-
<h1 style="font-size: 24px; font-weight: bold; margin-bottom: 16px">
|
103 |
-
Python YouTube Ringtones
|
104 |
-
</h1>
|
105 |
-
<p style="margin-top: 16px; text-align: center; color: #fbbf24">
|
106 |
-
βͺβ¬βͺβ¬ <span id="ringtone-count">0</span>
|
107 |
-
</p>
|
108 |
-
<br />
|
109 |
-
<div style="display: flex; gap: 8px">
|
110 |
-
<input
|
111 |
-
id="youtube-url"
|
112 |
-
type="text"
|
113 |
-
placeholder="Enter YouTube URL"
|
114 |
-
style="
|
115 |
-
flex-grow: 1;
|
116 |
-
padding: 8px;
|
117 |
-
border: 1px solid #4b5563;
|
118 |
-
border-radius: 4px;
|
119 |
-
background-color: #374151;
|
120 |
-
color: white;
|
121 |
-
"
|
122 |
-
/>
|
123 |
-
<button
|
124 |
-
onclick="pasteClipboard()"
|
125 |
-
style="
|
126 |
-
background-color: #6b7280;
|
127 |
-
color: white;
|
128 |
-
padding: 8px 12px;
|
129 |
-
border-radius: 4px;
|
130 |
-
"
|
131 |
-
>
|
132 |
-
✎
|
133 |
-
</button>
|
134 |
-
</div>
|
135 |
-
<button
|
136 |
-
onclick="processRingtone()"
|
137 |
-
style="
|
138 |
-
width: 100%;
|
139 |
-
background-color: #4f46e5;
|
140 |
-
color: white;
|
141 |
-
padding: 12px 16px;
|
142 |
-
border-radius: 4px;
|
143 |
-
margin-top: 16px;
|
144 |
-
"
|
145 |
-
>
|
146 |
-
Create Ringtones
|
147 |
-
</button>
|
148 |
-
<p
|
149 |
-
id="status"
|
150 |
-
style="text-align: center; margin-top: 16px; color: #fbbf24"
|
151 |
-
></p>
|
152 |
-
<a
|
153 |
-
id="android-ringtone"
|
154 |
-
href="#"
|
155 |
-
download="android_ringtone.mp3"
|
156 |
-
style="
|
157 |
-
display: none;
|
158 |
-
margin-top: 16px;
|
159 |
-
color: #34b334;
|
160 |
-
text-decoration: none;
|
161 |
-
"
|
162 |
-
>β¬ Android Ringtone</a>
|
163 |
-
|
164 |
-
<a
|
165 |
-
id="iphone-ringtone"
|
166 |
-
href="#"
|
167 |
-
download
|
168 |
-
style="
|
169 |
-
display: none;
|
170 |
-
margin-top: 16px;
|
171 |
-
color: #3b82f6;
|
172 |
-
text-decoration: none;
|
173 |
-
"
|
174 |
-
>β¬ iPhone Ringtone</a
|
175 |
-
>
|
176 |
-
</div>
|
177 |
-
<script>
|
178 |
-
const REDIS_URL = "https://amused-walleye-31373.upstash.io";
|
179 |
-
const REDIS_TOKEN =
|
180 |
-
"AXqNASQgMWZmMTdjYTEtNTJjYi00MDczLWJmZDctNjFjZGUyOTA0ZjEyNjcyMTI0NDM2MDBjNDVmZmE5NjJlMTllYTkyMDI2MDU=";
|
181 |
-
|
182 |
-
async function updateRingtoneCount() {
|
183 |
-
try {
|
184 |
-
const response = await fetch(`${REDIS_URL}/get/ringtone_count`, {
|
185 |
-
headers: { Authorization: `Bearer ${REDIS_TOKEN}` },
|
186 |
-
});
|
187 |
-
const data = await response.json();
|
188 |
-
document.getElementById("ringtone-count").innerText =
|
189 |
-
data.result || 0;
|
190 |
-
} catch (error) {
|
191 |
-
console.error("Error fetching ringtone count:", error);
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
async function incrementRingtoneCount() {
|
196 |
-
try {
|
197 |
-
await fetch(`${REDIS_URL}/incr/ringtone_count`, {
|
198 |
-
headers: { Authorization: `Bearer ${REDIS_TOKEN}` },
|
199 |
-
});
|
200 |
-
updateRingtoneCount();
|
201 |
-
} catch (error) {
|
202 |
-
console.error("Error updating ringtone count:", error);
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
async function processRingtone() {
|
207 |
-
const urlInput = document.getElementById("youtube-url").value;
|
208 |
-
const androidLink = document.getElementById("android-ringtone");
|
209 |
-
const iphoneLink = document.getElementById("iphone-ringtone");
|
210 |
-
const status = document.getElementById("status");
|
211 |
-
const ringtoneContainer = document.getElementById("ringtone-container");
|
212 |
-
|
213 |
-
if (!urlInput) {
|
214 |
-
status.innerText = "β Please enter a YouTube URL!";
|
215 |
-
return;
|
216 |
-
}
|
217 |
-
|
218 |
-
try {
|
219 |
-
status.innerText = "β³ one moment please...";
|
220 |
-
const client = await import(
|
221 |
-
"https://cdn.jsdelivr.net/npm/@gradio/client/+esm"
|
222 |
-
).then((m) => m.Client);
|
223 |
-
const connectedClient = await client.connect("sudo-soldier/PYTR");
|
224 |
-
const result = await connectedClient.predict(
|
225 |
-
"/process_youtube_or_audio",
|
226 |
-
{
|
227 |
-
url: urlInput,
|
228 |
-
recorded_audio: null,
|
229 |
-
},
|
230 |
-
);
|
231 |
-
const androidFile = result.data[0]?.url || result.data[0]?.path;
|
232 |
-
const iphoneFile = result.data[1]?.url || result.data[1]?.path;
|
233 |
-
|
234 |
-
if (androidFile) {
|
235 |
-
androidLink.href = androidFile;
|
236 |
-
androidLink.download = "android_ringtone.mp3";
|
237 |
-
androidLink.style.display = "block";
|
238 |
-
}
|
239 |
-
if (iphoneFile) {
|
240 |
-
iphoneLink.href = iphoneFile;
|
241 |
-
iphoneLink.download = "iphone_ringtone.m4r";
|
242 |
-
iphoneLink.style.display = "block";
|
243 |
-
}
|
244 |
-
status.innerText = "JesseJesse.xyz";
|
245 |
-
ringtoneContainer.classList.add("glow-border");
|
246 |
-
incrementRingtoneCount();
|
247 |
-
} catch (error) {
|
248 |
-
console.error(error);
|
249 |
-
status.innerText = "Error processing request!";
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
-
async function pasteClipboard() {
|
254 |
-
try {
|
255 |
-
const text = await navigator.clipboard.readText();
|
256 |
-
document.getElementById("youtube-url").value = text;
|
257 |
-
} catch (error) {
|
258 |
-
alert("Please add the song URL.");
|
259 |
-
}
|
260 |
-
}
|
261 |
-
</script>
|
262 |
-
</body>
|
263 |
-
</html>
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|