From ade1fa70cbaaaadaa4772e5f0564870cea3167ef Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sun, 9 Oct 2022 16:09:36 +0530 Subject: [extractor/generic] Separate embed extraction into own function (#5176) --- yt_dlp/extractor/common.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'yt_dlp/extractor/common.py') diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 18a52a855..10d44d95a 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -66,6 +66,7 @@ from ..utils import ( sanitize_filename, sanitize_url, sanitized_Request, + smuggle_url, str_or_none, str_to_int, strip_or_none, @@ -3873,6 +3874,12 @@ class InfoExtractor: def RetryManager(self, **kwargs): return RetryManager(self.get_param('extractor_retries', 3), self._error_or_warning, **kwargs) + def _extract_generic_embeds(self, url, *args, info_dict={}, note='Extracting generic embeds', **kwargs): + display_id = traverse_obj(info_dict, 'display_id', 'id') + self.to_screen(f'{format_field(display_id, None, "%s: ")}{note}') + return self._downloader.get_info_extractor('Generic')._extract_embeds( + smuggle_url(url, {'block_ies': [self.ie_key()]}), *args, **kwargs) + @classmethod def extract_from_webpage(cls, ydl, url, webpage): ie = (cls if isinstance(cls._extract_from_webpage, types.MethodType) -- cgit v1.2.3