deepak191z commited on
Commit
6846b53
·
verified ·
1 Parent(s): 0ed68d8

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +8 -10
index.js CHANGED
@@ -40,8 +40,7 @@ async function initBrowser() {
40
  return globalBrowser;
41
  }
42
 
43
- const html = `
44
- <!DOCTYPE html>
45
  <html lang="en">
46
  <head>
47
  <meta charset="UTF-8">
@@ -178,16 +177,16 @@ const html = `
178
  if (response.ok) {
179
  const data = await response.json();
180
  resultDiv.textContent = data.transcript;
181
- statusDiv.textContent = `[SUCCESS] Transcript extracted in ${duration}s`;
182
  } else {
183
  const error = await response.text();
184
- resultDiv.textContent = `Error: ${error}`;
185
- statusDiv.textContent = '[ERROR] Failed to extract transcript';
186
  }
187
  } catch (error) {
188
  console.error('Error:', error);
189
  resultDiv.textContent = 'Network error occurred. Please try again.';
190
- statusDiv.textContent = '[ERROR] Network error';
191
  } finally {
192
  // Reset UI
193
  submitBtn.disabled = false;
@@ -197,8 +196,7 @@ const html = `
197
  });
198
  </script>
199
  </body>
200
- </html>
201
- `;
202
 
203
  app.get('/', (req, res) => {
204
  res.send(html);
@@ -348,7 +346,7 @@ const PORT = process.env.PORT || 7860;
348
  // Initialize browser on startup
349
  initBrowser().then(() => {
350
  app.listen(PORT, () => {
351
- console.log(`Fast YouTube Transcript Server running on port ${PORT}`);
352
- console.log(`Access the web interface at http://localhost:${PORT}`);
353
  });
354
  }).catch(console.error);
 
40
  return globalBrowser;
41
  }
42
 
43
+ const html = `<!DOCTYPE html>
 
44
  <html lang="en">
45
  <head>
46
  <meta charset="UTF-8">
 
177
  if (response.ok) {
178
  const data = await response.json();
179
  resultDiv.textContent = data.transcript;
180
+ statusDiv.textContent = 'SUCCESS: Transcript extracted in ' + duration + 's';
181
  } else {
182
  const error = await response.text();
183
+ resultDiv.textContent = 'Error: ' + error;
184
+ statusDiv.textContent = 'ERROR: Failed to extract transcript';
185
  }
186
  } catch (error) {
187
  console.error('Error:', error);
188
  resultDiv.textContent = 'Network error occurred. Please try again.';
189
+ statusDiv.textContent = 'ERROR: Network error';
190
  } finally {
191
  // Reset UI
192
  submitBtn.disabled = false;
 
196
  });
197
  </script>
198
  </body>
199
+ </html>`;
 
200
 
201
  app.get('/', (req, res) => {
202
  res.send(html);
 
346
  // Initialize browser on startup
347
  initBrowser().then(() => {
348
  app.listen(PORT, () => {
349
+ console.log('Fast YouTube Transcript Server running on port ' + PORT);
350
+ console.log('Access the web interface at http://localhost:' + PORT);
351
  });
352
  }).catch(console.error);