I have this script:
// content.js - Extracts YouTube Transcript and Sends it to an APIasync function getTranscript() { console.log("getTranscript() function started!"); // Debugging const videoId = new URLSearchParams(window.location.search).get("v"); if (!videoId) { console.log("No video ID found."); return; } console.log("Found video ID:", videoId); const response = await fetch(`https://www.youtube.com/api/timedtext?lang=en&v=${videoId}`); if (!response.ok) { console.log("Could not fetch transcript."); return; } const transcriptText = await response.text(); if (!transcriptText) { console.log("No transcript found."); return; } console.log("Transcript extracted successfully:", transcriptText.substring(0, 100), "..."); // Log first 100 chars // Store locally chrome.storage.local.set({ transcript: transcriptText }, () => { console.log("Transcript saved."); }); // Send transcript to the server sendTranscriptToServer(transcriptText);}// Run on page loadwindow.onload = getTranscript;async function sendTranscriptToServer(transcript) { console.log("sendTranscriptToServer() called!"); // Check if function runs const endpoint = "http://139.169.160.58:8081/api/transcript"; try { console.log("Sending transcript to server:", transcript); // Log transcript data const response = await fetch(endpoint, { method: "POST", headers: {"Content-Type": "application/json" }, body: JSON.stringify({ text: transcript }) }); console.log("Request sent, waiting for response..."); if (response.ok) { const responseData = await response.text(); console.log("Server Response:", responseData); alert("Server Response: " + responseData); } else { console.error("Failed to send transcript.", response.statusText); } } catch (error) { console.error("Error sending transcript:", error); }}// Run the script when the video page loadswindow.onload = getTranscript;I see this messages , but I don't receive any call in the server and no errors in the console
