Last active
January 15, 2025 18:23
-
-
Save jeffersonchaves/26d1a4b4704f920ef506a85d8f6f7550 to your computer and use it in GitHub Desktop.
cineFind.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cineFind(movieName){ | |
const apiUrl = `https://api.themoviedb.org/3/search/movie?api_key=2dbca7a779fef19d8dc0acc77384df5a&query=${movieName}&language=pt-BR`; | |
fetch(apiUrl) | |
.then(response => response.json()) | |
.then(data => { | |
if (data.results.length > 0) { | |
const movie = data.results[0]; | |
document.getElementById('results').innerHTML += | |
` | |
<h2>${movie.title}</h2> | |
<p>${movie.overview}</p> | |
<img src="https://image.tmdb.org/t/p/w200${movie.poster_path}" alt="${movie.title}"> | |
`; | |
} | |
}) | |
.catch(error => { | |
console.error('Erro:', error); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment