Last active
June 21, 2021 10:44
-
-
Save dimitryzub/ae6d81f60092fa587f7db6112a54da6c to your computer and use it in GitHub Desktop.
youtube_serpapi_get_movie_results
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
from serpapi import GoogleSearch | |
def get_movie_results(): | |
params = { | |
"api_key": "YOUR_API_KEY", | |
"engine": "youtube", | |
"search_query": "mortal kombat 2021 movie" | |
} | |
search = GoogleSearch(params) | |
results = search.get_dict() | |
for result in results['movie_results']: | |
title = result['title'] | |
link = result['link'] | |
channel = result['channel'] | |
desc = result['description'] | |
movie_info = result['info'] | |
print(f'{title}\n{link}\n{channel}\n{desc}\n{movie_info}\n') | |
get_movie_results() | |
# output: | |
''' | |
Mortal Kombat (2021) | |
https://www.youtube.com/watch?v=Q5s_rHFxbSA | |
{'name': 'YouTube Movies', 'link': 'https://www.youtube.com/channel/UClgRkhTL3_hImCAmdLfDE4g', 'verified': True} | |
['Action & Adventure • 2021 • R • English audio (and 8 more)', 'Actors: Lewis Tan, Jessica McNamee, Josh Lawson', 'Director: Simon McQuoid'] | |
Mortal Kombat Legends: Scorpion's Revenge | |
https://www.youtube.com/watch?v=YA8h-_BMT-E | |
{'name': 'YouTube Movies', 'link': 'https://www.youtube.com/channel/UClgRkhTL3_hImCAmdLfDE4g', 'verified': True} | |
['Animation • 2020 • R • English audio (and 4 more)', 'Actor: Darren De Paul', 'Director: Ethan Spaulding'] | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment