sudo-soldier commited on
Commit
d9ee000
Β·
verified Β·
1 Parent(s): 80f04f5

Update api.html

Browse files
Files changed (1) hide show
  1. api.html +188 -103
api.html CHANGED
@@ -1,103 +1,183 @@
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
- <meta httpEquiv="Content-Type" content="text/html; charset=utf-8" />
7
- <title>Python YouTube Ringtones</title>
8
- <meta name="title" content="Python YouTube Ringtones" />
9
- <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!" />
10
- <meta property="og:type" content="website" />
11
- <meta property="og:url" content="https://ringtones.jessejesse.xyz" />
12
- <meta property="og:title" content="Python YouTube Ringtones" />
13
- <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!" />
14
- <meta property="og:image" content="https://ringtones.jessejesse.xyz/og.png" />
15
- <meta property="twitter:card" content="summary_large_image" />
16
- <meta property="twitter:url" content="https://ringtones.jessejesse.xyz" />
17
- <meta property="twitter:title" content="Python YouTube Ringtones" />
18
- <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!" />
19
- <meta property="twitter:image" content="https://ringtones.jessejesse.xyz/og.png" />
20
- <meta name="author" content="JesseJesse.xyz" />
21
-
22
- <style>
23
- body {
24
- background: linear-gradient(135deg, #1a1a2e, #111827, #0f0f14);
25
- color: white;
26
- visibility: hidden;
27
- }
28
- </style>
29
 
30
- <script src="https://cdn.tailwindcss.com"></script>
 
31
 
32
- <script>
33
- document.addEventListener("DOMContentLoaded", () => {
34
- document.body.style.visibility = "visible";
35
- updateRingtoneCount(); // Fetch count on page load
36
- });
37
- </script>
38
- </head>
39
-
40
- <body class="bg-gradient-to-br from-gray-900 via-gray-800 to-black text-white flex flex-col justify-center items-center h-screen">
41
- <div class="w-full max-w-md bg-transparent p-6 rounded-lg shadow-lg text-center">
42
- <img src="icon.png" alt="App Icon" class="w-20 h-20 mx-auto mb-4" />
43
- <h1 class="text-xl font-bold mb-4">Python YouTube Ringtones</h1>
44
- <p class="mt-4 text-center text-yellow-400">
45
- β™ͺ♬β™ͺ♬&nbsp;tones made:&nbsp;<span id="ringtone-count">0</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  </p>
47
  <br />
48
- <div class="flex gap-2">
49
  <input
50
  id="youtube-url"
51
  type="text"
52
  placeholder="Enter YouTube URL"
53
- class="flex-1 p-2 border border-gray-700 rounded bg-gray-700 text-white"
 
 
 
 
 
 
 
54
  />
55
- <button onclick="pasteClipboard()" class="bg-gray-600 hover:bg-gray-500 px-3 py-2 rounded">
 
 
 
 
 
 
 
 
56
  &#9998;
57
  </button>
58
  </div>
59
-
60
- <input
61
- id="mp3-upload"
62
- type="file"
63
- accept="audio/*"
64
- class="w-full p-2 mt-4 border border-gray-700 rounded bg-gray-700 text-white"
65
- />
66
-
67
  <button
68
  onclick="processRingtone()"
69
- class="w-full bg-indigo-700 hover:bg-green-800 text-white py-2 px-4 rounded mt-4"
 
 
 
 
 
 
 
70
  >
71
- Generate Ringtones
72
  </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- <p id="status" class="text-center mt-4 text-yellow-400"></p>
75
-
76
- <a
77
- id="android-ringtone"
78
- href="#"
79
- download
80
- class="hidden block mt-4 text-center text-green-800"
81
- >⬇ Android Ringtone</a
82
- >
83
  <a
84
  id="iphone-ringtone"
85
  href="#"
86
  download
87
- class="hidden block mt-4 text-center text-green-400"
 
 
 
 
 
88
  >⬇ iPhone Ringtone</a
89
  >
90
  </div>
91
-
92
- <footer class="mt-6 text-green-600 text-sm text-center cursor-pointer" onclick="sharePage()">
93
- JesseJesse.xyz
94
- </footer>
95
- <br />
96
- <span class="inline-block ml-2 text-sm text-center cursor-pointer">&#9757;&nbsp;share</span>
97
-
98
  <script>
99
  const REDIS_URL = "https://amused-walleye-31373.upstash.io";
100
- const REDIS_TOKEN = "AXqNASQgMWZmMTdjYTEtNTJjYi00MDczLWJmZDctNjFjZGUyOTA0ZjEyNjcyMTI0NDM2MDBjNDVmZmE5NjJlMTllYTkyMDI2MDU=";
 
101
 
102
  async function updateRingtoneCount() {
103
  try {
@@ -105,7 +185,8 @@
105
  headers: { Authorization: `Bearer ${REDIS_TOKEN}` },
106
  });
107
  const data = await response.json();
108
- document.getElementById("ringtone-count").innerText = data.result || 0;
 
109
  } catch (error) {
110
  console.error("Error fetching ringtone count:", error);
111
  }
@@ -116,7 +197,7 @@
116
  await fetch(`${REDIS_URL}/incr/ringtone_count`, {
117
  headers: { Authorization: `Bearer ${REDIS_TOKEN}` },
118
  });
119
- updateRingtoneCount(); //count
120
  } catch (error) {
121
  console.error("Error updating ringtone count:", error);
122
  }
@@ -124,27 +205,29 @@
124
 
125
  async function processRingtone() {
126
  const urlInput = document.getElementById("youtube-url").value;
127
- const fileInput = document.getElementById("mp3-upload").files[0];
128
  const androidLink = document.getElementById("android-ringtone");
129
  const iphoneLink = document.getElementById("iphone-ringtone");
130
  const status = document.getElementById("status");
 
131
 
132
- if (!urlInput && !fileInput) {
133
- status.innerText = "❌ Please enter a YouTube URL or upload an MP3 file!";
134
  return;
135
  }
136
 
137
  try {
138
  status.innerText = "⏳ one moment please...";
139
- const client = await import("https://cdn.jsdelivr.net/npm/@gradio/client/+esm").then((m) => m.Client);
 
 
140
  const connectedClient = await client.connect("sudo-soldier/PYTR");
141
-
142
- const inputData = {
143
- url: urlInput || "Hello!!",
144
- uploaded_file: fileInput || null,
145
- };
146
- const result = await connectedClient.predict("/process_youtube_url", inputData);
147
-
148
  const androidFile = result.data[0]?.url || result.data[0]?.path;
149
  const iphoneFile = result.data[1]?.url || result.data[1]?.path;
150
 
@@ -153,15 +236,14 @@
153
  androidLink.download = "android_ringtone.mp3";
154
  androidLink.style.display = "block";
155
  }
156
-
157
  if (iphoneFile) {
158
  iphoneLink.href = iphoneFile;
159
  iphoneLink.download = "iphone_ringtone.m4r";
160
  iphoneLink.style.display = "block";
161
  }
162
-
163
- status.innerText = "Ringtones Ready!";
164
- incrementRingtoneCount(); //count
165
  } catch (error) {
166
  console.error(error);
167
  status.innerText = "Error processing request!";
@@ -173,20 +255,7 @@
173
  const text = await navigator.clipboard.readText();
174
  document.getElementById("youtube-url").value = text;
175
  } catch (error) {
176
- alert("Clipboard access denied! Please paste manually.");
177
- }
178
- }
179
-
180
- function sharePage() {
181
- if (navigator.share) {
182
- navigator
183
- .share({
184
- title: "ringtones.JesseJesse.xyz",
185
- url: window.location.href,
186
- })
187
- .catch((error) => console.log("Sharing failed:", error));
188
- } else {
189
- alert("Share API not supported in this browser.");
190
  }
191
  }
192
  </script>
@@ -196,3 +265,19 @@
196
 
197
 
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ β™ͺ♬β™ͺ♬&nbsp;&nbsp; <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
  &#9998;
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 {
 
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
  }
 
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
  }
 
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
 
 
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!";
 
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>
 
265
 
266
 
267
 
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+