aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/common.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-10-31 17:35:20 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-10-31 17:41:48 +0530
commit62b8dac4908bdb340e173bb70048f0f22e825007 (patch)
tree9cf41bda8c6af5da64e4ee4f5c90caab85fb860e /yt_dlp/extractor/common.py
parent682b4524bfb2ce18eada6fbddd2d5541d3cb5e88 (diff)
downloadhypervideo-pre-62b8dac4908bdb340e173bb70048f0f22e825007.tar.lz
hypervideo-pre-62b8dac4908bdb340e173bb70048f0f22e825007.tar.xz
hypervideo-pre-62b8dac4908bdb340e173bb70048f0f22e825007.zip
[extractor] Improve `_generic_title`
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r--yt_dlp/extractor/common.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index fb787a722..84a2b95af 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -3820,9 +3820,11 @@ class InfoExtractor:
def _generic_id(url):
return urllib.parse.unquote(os.path.splitext(url.rstrip('/').split('/')[-1])[0])
- @staticmethod
- def _generic_title(url):
- return urllib.parse.unquote(os.path.splitext(url_basename(url))[0])
+ def _generic_title(self, url='', webpage='', *, default=None):
+ return (self._og_search_title(webpage, default=None)
+ or self._html_extract_title(webpage, default=None)
+ or urllib.parse.unquote(os.path.splitext(url_basename(url))[0])
+ or default)
@staticmethod
def _availability(is_private=None, needs_premium=None, needs_subscription=None, needs_auth=None, is_unlisted=None):