Can be used to get search results with custom defined filters.
Setting second parameter as VideoSortOrder.uploadDate, to get video results sorted according to upload date.
Few of the predefined filters for you to use are:
SearchMode.videos
VideoUploadDateFilter.lastHour
VideoDurationFilter.long
VideoSortOrder.viewCount
There are many other for you to check out.
If this much control isn't enough then, you may pass custom string yourself by seeing the YouTube query in any web browser e.g.
"EgQIBRAB" from "https://www.youtube.com/results?search_query=NoCopyrightSounds&sp=EgQIBRAB" may be passed as second parameter to get only videos, which are uploaded this year.
You may show search suggestions to users before making any search.
To use this, you must have PyTube installed.
StreamURLFetcher can fetch direct video URLs without any additional network requests (that's really fast).
Call `get` or `getAll` method of StreamURLFetcher & pass response returned by `Video.get` or `Video.getFormats` as parameter to fetch direct URLs.
Getting URLs or downloading streams using youtube-dl or PyTube is can be a slow, because of the fact that they make requests to fetch the same content, which one might have already recieved at the time of showing it to the user etc.
StreamURLFetcher makes use of PyTube (if installed) & makes some slight improvements to functioning of PyTube.
Avoid instantiating StreamURLFetcher more than once, it will be slow (making global object of the class will be a recommended solution).
`get` method can be handy for getting URL of a particular kind. `getAll` returns all stream URLs in a dictionary.
'''
fetcher=StreamURLFetcher()
'''
Call this method after instanciating StreamURLFetcher & avoid calling more than once.
# you actually don't have to pass a valid URL in following Transcript call. You can input an empty string, but I do recommend still inputing a valid URL.
transcript_2=awaitTranscript.get(url, transcript_en["languages"][-1]["params"]) # in my case, it'd output Spanish.