- Search YouTube for videos, channels, and playlists
 - Retrieve video information and available formats
 - Extract comments from videos
 - Get video transcripts in different languages
 - Fetch search suggestions from YouTube
 - Retrieve details of YouTube channels and their playlists
 
Make sure you have Python installed (>=3.8). Install py-yt-search using:
pip install git+https://github.com/AshokShau/py-yt-search@masterpip install py-yt-searchThe script uses asyncio to execute YouTube queries asynchronously. Below is an overview of the main functions:
_search = Search('NoCopyrightSounds', limit=1, language='en', region='US')
result = await _search.next()
print(result)videosSearch = VideosSearch('NoCopyrightSounds', limit=10, language='en', region='US')
videosResult = await videosSearch.next()
print(videosResult)channelsSearch = ChannelsSearch('NoCopyrightSounds', limit=1, language='en', region='US')
channelsResult = await channelsSearch.next()
print(channelsResult)playlistsSearch = PlaylistsSearch('NoCopyrightSounds', limit=1, language='en', region='US')
playlistsResult = await playlistsSearch.next()
print(playlistsResult)video = await Video.get('z0GKGpObgPY')
print(video)playlist = await Playlist.get('https://www.youtube.com/playlist?list=PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
print(playlist)comments = Comments('_ZdsmLgCVdU')
await comments.getNextComments()
print(len(comments.comments['result']))transcript = await Transcript.get('https://www.youtube.com/watch?v=L7kF4MXXCoA')
print(transcript)suggestions = await Suggestions.get('NoCopyrightSounds', language='en', region='US')
print(suggestions)To run the script, execute:
python script.pyEnsure asyncio.run(main()) is at the end of the script to handle async execution.
- The script uses 
asynciofor efficient asynchronous operations. - Some operations may require multiple calls to retrieve all available data (e.g., pagination for comments and playlists).
 py-yt-searchprovides various search filters to refine results, such as sorting by upload date or filtering by duration.
This project is licensed under the MIT License. See the LICENSE file for details.
This project is based on youtube-search-python by Alex Mercer.