From 76ad2e5641848346f45bd07ac2bf24f47d7c3ac6 Mon Sep 17 00:00:00 2001 From: Omar Najjar Date: Mon, 4 Mar 2024 04:26:29 +1100 Subject: [PATCH] cloudflare workers bby --- index.html | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 75c6810..ac0446c 100644 --- a/index.html +++ b/index.html @@ -328,15 +328,13 @@ function displaySearchResults(movies) {

${movie.title}

${movie.overview}

- + +
+
+
`; resultsContainer.appendChild(movieElement); - - // Attach event listener to the "Stream" button - movieElement.querySelector('.stream-btn').addEventListener('click', function() { - fetchAndStreamMovie(movie.title); - }); }); } @@ -351,6 +349,31 @@ function fetchAndStreamMovie(title) { openVideoPlayer(); } +function sendToCloudflare(movieId) { + const apiKey = '8bb85bb00bf81f0ad511a7609d736c7f'; // Use your actual API key + fetch(`https://api.themoviedb.org/3/movie/${movieId}/external_ids?api_key=${apiKey}`) + .then(response => response.json()) + .then(data => { + if (data.imdb_id) { + const imdbId = data.imdb_id; + // Replace YOUR_CLOUDFLARE_WORKER_URL with your actual Cloudflare Worker URL + const url = `https://addtorrentstoqbitorrent.omar-c29.workers.dev/?imdbID=${imdbId}`; + // Make a GET request to the Cloudflare Worker + fetch(url).then(response => { + if (response.ok) { + console.log(`Successfully sent IMDb ID ${imdbId} to Cloudflare Worker.`); + // Process response from Cloudflare Worker here, if necessary + } else { + console.error('Failed to send IMDb ID to Cloudflare Worker. Response status:', response.status); + } + }).catch(error => console.error('Error sending IMDb ID to Cloudflare Worker:', error)); + } else { + console.error('IMDb ID not found for movie ID:', movieId); + } + }) + .catch(error => console.error('Error fetching IMDb ID:', error)); +} + // Add this function to update the video player's URL and display it function updateVideoPlayerAndShow(url) {