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) {