Skip to content

Commit

Permalink
Create imdb2.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cirolini authored May 21, 2024
1 parent c316e1d commit 705d675
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions imdb2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import requests

def get_imdb_movies(page_number):
url = "https://api.themoviedb.org/3/discover/movie?api_key=YOUR_API_KEY&language=pt-BR&sort_by=popularity.desc&page={}".format(page_number)
response = requests.get(url)
if response.status_code == 200:
data = response.json()
return data["results"]
else:
return None


def main():
# Obtém a lista de filmes da página 1
movies = get_imdb_movies(1)

# Imprime os títulos dos filmes
for movie in movies:
print(movie["title"])


if __name__ == "__main__":
main()

0 comments on commit 705d675

Please sign in to comment.