Created
June 20, 2021 05:07
-
-
Save dimitryzub/31af899c53fc5bd1345c0d7e0ec6fe0f to your computer and use it in GitHub Desktop.
serpapi_youtube_get_channel
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_channel_results(): | |
params = { | |
"api_key": "YOUR_API_KEY", | |
"engine": "youtube", | |
"search_query": "mojang" | |
} | |
search = GoogleSearch(params) | |
results = search.get_dict() | |
for result in results['channel_results']: | |
title = result['title'] | |
link = result['link'] | |
verified = result['verified'] | |
subs = result['subscribers'] | |
video_count = result['video_count'] | |
desc = result['description'] | |
print(f'{title}\n{link}\n{verified}\n{subs}\n{video_count}\n{desc}\n') | |
get_channel_results() | |
# output: | |
''' | |
Minecraft | |
https://www.youtube.com/user/TeamMojang | |
True | |
7400000.0 | |
542 | |
This is the official YouTube channel of Minecraft. We tell stories about the Minecraft Universe. ESRB Rating: Everyone 10+ with ... | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment