Skip to content

Instantly share code, notes, and snippets.

@dimitryzub
Created June 20, 2021 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimitryzub/31af899c53fc5bd1345c0d7e0ec6fe0f to your computer and use it in GitHub Desktop.
Save dimitryzub/31af899c53fc5bd1345c0d7e0ec6fe0f to your computer and use it in GitHub Desktop.
serpapi_youtube_get_channel
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