@@ -333,13 +333,7 @@ def author(self) -> str:
333333 self .logger .error ("Couldn't find author. Please report this!" )
334334 return None
335335
336- def direct_download_link (self , quality , mode ) -> str :
337- """
338- Returns the direct download URL for a given quality (best/half/worst or a specific resolution).
339- :param quality: 'best', 'half', 'worst', or a specific resolution like '720', '720p', 1080, etc.
340- :param mode: The mode to filter links by (e.g., 'video')
341- :return: str
342- """
336+ def _direct_download_quality_map (self , mode ) -> dict [int , str ]:
343337 if not self .enable_html :
344338 raise HTML_IS_DISABLED ("HTML content is disabled! See Documentation for more details" )
345339
@@ -369,6 +363,25 @@ def direct_download_link(self, quality, mode) -> str:
369363 height = int (m .group (1 )) # e.g., 1080
370364 quality_to_url [height ] = href # last one wins; order doesn't matter
371365
366+ return quality_to_url
367+
368+ def video_qualities (self , mode = Encoding .mp4_h264 ) -> list :
369+ """
370+ Returns the available direct download qualities for a given mode.
371+ :param mode: The mode to filter links by (e.g., 'video')
372+ :return: list
373+ """
374+ quality_to_url = self ._direct_download_quality_map (mode )
375+ return sorted (quality_to_url .keys ())
376+
377+ def direct_download_link (self , quality , mode ) -> str :
378+ """
379+ Returns the direct download URL for a given quality (best/half/worst or a specific resolution).
380+ :param quality: 'best', 'half', 'worst', or a specific resolution like '720', '720p', 1080, etc.
381+ :param mode: The mode to filter links by (e.g., 'video')
382+ :return: str
383+ """
384+ quality_to_url = self ._direct_download_quality_map (mode )
372385 if not quality_to_url :
373386 raise NotAvailable (f"No URLs available for mode '{ mode } '" )
374387
0 commit comments