youtube search api python code example

Example 1: python youtube search

from youtube_search import YoutubeSearch

results = YoutubeSearch('search terms', max_results=10).to_json()

print(results)

# returns a json string

########################################

results = YoutubeSearch('search terms', max_results=10).to_dict()

print(results)
# returns a dictionary

Example 2: youtube api python

git clone https://github.com/vprusso/youtube_tutorials/tree/master/youtube_python
pip3 install pytube
xdg-open https://developers.google.com/youtube/v3/docs