]> jfr.im git - yt-dlp.git/commitdiff
[extractor] Add `write_debug` and `get_param`
authorpukkandan <redacted>
Mon, 17 May 2021 12:23:08 +0000 (17:53 +0530)
committerpukkandan <redacted>
Mon, 17 May 2021 13:29:51 +0000 (18:59 +0530)
52 files changed:
README.md
yt_dlp/YoutubeDL.py
yt_dlp/extractor/adobepass.py
yt_dlp/extractor/afreecatv.py
yt_dlp/extractor/bbc.py
yt_dlp/extractor/bilibili.py
yt_dlp/extractor/brightcove.py
yt_dlp/extractor/ceskatelevize.py
yt_dlp/extractor/common.py
yt_dlp/extractor/commonmistakes.py
yt_dlp/extractor/crackle.py
yt_dlp/extractor/dailymotion.py
yt_dlp/extractor/daum.py
yt_dlp/extractor/deezer.py
yt_dlp/extractor/generic.py
yt_dlp/extractor/globo.py
yt_dlp/extractor/hotstar.py
yt_dlp/extractor/imggaming.py
yt_dlp/extractor/ivi.py
yt_dlp/extractor/kaltura.py
yt_dlp/extractor/limelight.py
yt_dlp/extractor/litv.py
yt_dlp/extractor/nba.py
yt_dlp/extractor/neteasemusic.py
yt_dlp/extractor/ninecninemedia.py
yt_dlp/extractor/ninenow.py
yt_dlp/extractor/npo.py
yt_dlp/extractor/onet.py
yt_dlp/extractor/philharmoniedeparis.py
yt_dlp/extractor/pluralsight.py
yt_dlp/extractor/plutotv.py
yt_dlp/extractor/pokemon.py
yt_dlp/extractor/prosiebensat1.py
yt_dlp/extractor/rai.py
yt_dlp/extractor/rtbf.py
yt_dlp/extractor/ruutu.py
yt_dlp/extractor/shahid.py
yt_dlp/extractor/sonyliv.py
yt_dlp/extractor/sportdeutschland.py
yt_dlp/extractor/steam.py
yt_dlp/extractor/toggle.py
yt_dlp/extractor/toutv.py
yt_dlp/extractor/tvnow.py
yt_dlp/extractor/twitcasting.py
yt_dlp/extractor/viki.py
yt_dlp/extractor/vimeo.py
yt_dlp/extractor/viu.py
yt_dlp/extractor/vlive.py
yt_dlp/extractor/wakanim.py
yt_dlp/extractor/youku.py
yt_dlp/extractor/youtube.py
yt_dlp/extractor/zoom.py

index 916fe06657a0e596b1a4294cdcdec0780a7dce58..5e36b7ac0ea0ba1fb0dc5a42938ab34b9f93dd07 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1332,6 +1332,7 @@ #### Not recommended
     --list-formats-as-table          --compat-options -list-formats [Default] (Alias: --no-list-formats-old)
     --sponskrub-args ARGS            --ppa "sponskrub:ARGS"
     --test                           Used by developers for testing extractors. Not intended for the end user
+    --youtube-print-sig-code         Used for testing youtube signatures
 
 
 #### Old aliases
@@ -1362,7 +1363,6 @@ #### No longer supported
     --no-call-home                   Default
     --include-ads                    No longer supported
     --no-include-ads                 Default
-    --youtube-print-sig-code         No longer supported
 
 #### Removed
 These options were deprecated since 2014 and have now been entirely removed
index c7d31a7e956aa63adce1d0f987a8c95aa29cfd80..c2c2702378417bdcb2d783bac3b8de40db2247c9 100644 (file)
@@ -48,7 +48,6 @@
     date_from_str,
     DateRange,
     DEFAULT_OUTTMPL,
-    OUTTMPL_TYPES,
     determine_ext,
     determine_protocol,
     DOT_DESKTOP_LINK_TEMPLATE,
@@ -57,8 +56,8 @@
     DownloadError,
     encode_compat_str,
     encodeFilename,
-    error_to_compat_str,
     EntryNotInPlaylist,
+    error_to_compat_str,
     ExistingVideoReached,
     expand_path,
     ExtractorError,
@@ -77,6 +76,7 @@
     MaxDownloadsReached,
     network_exceptions,
     orderedSet,
+    OUTTMPL_TYPES,
     PagedList,
     parse_filesize,
     PerRequestProxyHandler,
     PostProcessingError,
     preferredencoding,
     prepend_extension,
+    process_communicate_or_kill,
     random_uuidv4,
     register_socks_protocols,
+    RejectedVideoReached,
     render_table,
     replace_extension,
-    RejectedVideoReached,
     SameFileError,
     sanitize_filename,
     sanitize_path,
     YoutubeDLCookieProcessor,
     YoutubeDLHandler,
     YoutubeDLRedirectHandler,
-    process_communicate_or_kill,
 )
 from .cache import Cache
 from .extractor import (
index 79a532858d1988a7d07fadcce08e4a6e18fec9cd..47cae661e155355d6f05676418e98fc52cff0e8a 100644 (file)
@@ -1414,7 +1414,7 @@ def extract_redirect_url(html, url=None, fatal=False):
                 authn_token = None
             if not authn_token:
                 # TODO add support for other TV Providers
-                mso_id = self._downloader.params.get('ap_mso')
+                mso_id = self.get_param('ap_mso')
                 if not mso_id:
                     raise_mvpd_required()
                 username, password = self._get_login_info('ap_username', 'ap_password', mso_id)
index 016a4d24aa22f23f62b31e309baa6d4c645e007c..648f1122dc674b9ad14a12cbaa51c78bd916de9f 100644 (file)
@@ -323,7 +323,7 @@ def _real_extract(self, url):
                         'url': file_url,
                         'format_id': 'http',
                     }]
-                if not formats and not self._downloader.params.get('ignore_no_formats'):
+                if not formats and not self.get_param('ignore_no_formats'):
                     continue
                 self._sort_formats(formats)
                 file_info = common_entry.copy()
index edc2c697b3e5863b6d72f73e12834316b8e25de4..09b2932d20ef53d799b4775c4644d407b63501d3 100644 (file)
@@ -1271,7 +1271,7 @@ def extract_all(pattern):
         entries = []
         for num, media_meta in enumerate(medias, start=1):
             formats, subtitles = self._extract_from_media_meta(media_meta, playlist_id)
-            if not formats and not self._downloader.params.get('ignore_no_formats'):
+            if not formats and not self.get_param('ignore_no_formats'):
                 continue
             self._sort_formats(formats)
 
index b7b60b77ebb6b2f1c5e187168d145e253e0767e5..baa7539769dfb1ae218fed48226255d6c9c15464 100644 (file)
@@ -153,7 +153,7 @@ def _real_extract(self, url):
         # Bilibili anthologies are similar to playlists but all videos share the same video ID as the anthology itself.
         # If the video has no page argument, check to see if it's an anthology
         if page_id is None:
-            if not self._downloader.params.get('noplaylist'):
+            if not self.get_param('noplaylist'):
                 r = self._extract_anthology_entries(bv_id, video_id, webpage)
                 if r is not None:
                     self.to_screen('Downloading anthology %s - add --no-playlist to just download video' % video_id)
@@ -299,7 +299,7 @@ def _real_extract(self, url):
             'tags': tags,
             'raw_tags': raw_tags,
         }
-        if self._downloader.params.get('getcomments', False):
+        if self.get_param('getcomments', False):
             def get_comments():
                 comments = self._get_all_comment_pages(video_id)
                 return {
index d2fd10064c3e58aba8c40d14c4dda9bb42eed700..9f643a9e7567b5b38e475f97c6601a5c85f0b1f2 100644 (file)
@@ -478,7 +478,7 @@ def _parse_brightcove_metadata(self, json_data, video_id, headers={}):
             container = source.get('container')
             ext = mimetype2ext(source.get('type'))
             src = source.get('src')
-            skip_unplayable = not self._downloader.params.get('allow_unplayable_formats')
+            skip_unplayable = not self.get_param('allow_unplayable_formats')
             # https://support.brightcove.com/playback-api-video-fields-reference#key_systems_object
             if skip_unplayable and (container == 'WVM' or source.get('key_systems')):
                 num_drm_sources += 1
@@ -547,7 +547,7 @@ def build_format_id(kind):
                 error = errors[0]
                 self.raise_no_formats(
                     error.get('message') or error.get('error_subcode') or error['error_code'], expected=True)
-            elif (not self._downloader.params.get('allow_unplayable_formats')
+            elif (not self.get_param('allow_unplayable_formats')
                     and sources and num_drm_sources == len(sources)):
                 raise ExtractorError('This video is DRM protected.', expected=True)
 
index 6bfb760fadd9f0b2ab04ada53dc170ff34f45c90..b2ebfdadd7c7ccbc8d1e7fe856a211ab30252d1e 100644 (file)
@@ -147,7 +147,7 @@ def _real_extract(self, url):
                 is_live = item.get('type') == 'LIVE'
                 formats = []
                 for format_id, stream_url in item.get('streamUrls', {}).items():
-                    if (not self._downloader.params.get('allow_unplayable_formats')
+                    if (not self.get_param('allow_unplayable_formats')
                             and 'drmOnly=true' in stream_url):
                         continue
                     if 'playerType=flash' in stream_url:
index b95a7a30979a1b5a8f6a3dae8b6d1df6c406b3ea..42824182f0ee2921bb5f0f2a813808fcea449cdb 100644 (file)
@@ -491,7 +491,7 @@ def _initialize_geo_bypass(self, geo_bypass_context):
         if not self._x_forwarded_for_ip:
 
             # Geo bypass mechanism is explicitly disabled by user
-            if not self._downloader.params.get('geo_bypass', True):
+            if not self.get_param('geo_bypass', True):
                 return
 
             if not geo_bypass_context:
@@ -513,7 +513,7 @@ def _initialize_geo_bypass(self, geo_bypass_context):
 
             # Explicit IP block specified by user, use it right away
             # regardless of whether extractor is geo bypassable or not
-            ip_block = self._downloader.params.get('geo_bypass_ip_block', None)
+            ip_block = self.get_param('geo_bypass_ip_block', None)
 
             # Otherwise use random IP block from geo bypass context but only
             # if extractor is known as geo bypassable
@@ -532,7 +532,7 @@ def _initialize_geo_bypass(self, geo_bypass_context):
 
             # Explicit country code specified by user, use it right away
             # regardless of whether extractor is geo bypassable or not
-            country = self._downloader.params.get('geo_bypass_country', None)
+            country = self.get_param('geo_bypass_country', None)
 
             # Otherwise use random country code from geo bypass context but
             # only if extractor is known as geo bypassable
@@ -552,12 +552,13 @@ def extract(self, url):
             for _ in range(2):
                 try:
                     self.initialize()
+                    self.write_debug('Extracting URL: %s' % url)
                     ie_result = self._real_extract(url)
                     if self._x_forwarded_for_ip:
                         ie_result['__x_forwarded_for_ip'] = self._x_forwarded_for_ip
                     subtitles = ie_result.get('subtitles')
                     if (subtitles and 'live_chat' in subtitles
-                            and 'no-live-chat' in self._downloader.params.get('compat_opts', [])):
+                            and 'no-live-chat' in self.get_param('compat_opts', [])):
                         del subtitles['live_chat']
                     return ie_result
                 except GeoRestrictedError as e:
@@ -572,9 +573,9 @@ def extract(self, url):
             raise ExtractorError('An extractor error has occurred.', cause=e)
 
     def __maybe_fake_ip_and_retry(self, countries):
-        if (not self._downloader.params.get('geo_bypass_country', None)
+        if (not self.get_param('geo_bypass_country', None)
                 and self._GEO_BYPASS
-                and self._downloader.params.get('geo_bypass', True)
+                and self.get_param('geo_bypass', True)
                 and not self._x_forwarded_for_ip
                 and countries):
             country_code = random.choice(countries)
@@ -628,7 +629,7 @@ def _request_webpage(self, url_or_request, video_id, note=None, errnote=None, fa
         See _download_webpage docstring for arguments specification.
         """
         if not self._downloader._first_webpage_request:
-            sleep_interval = float_or_none(self._downloader.params.get('sleep_interval_requests')) or 0
+            sleep_interval = float_or_none(self.get_param('sleep_interval_requests')) or 0
             if sleep_interval > 0:
                 self.to_screen('Sleeping %s seconds ...' % sleep_interval)
                 time.sleep(sleep_interval)
@@ -753,11 +754,11 @@ def _webpage_read_content(self, urlh, url_or_request, video_id, note=None, errno
             webpage_bytes = prefix + webpage_bytes
         if not encoding:
             encoding = self._guess_encoding_from_content(content_type, webpage_bytes)
-        if self._downloader.params.get('dump_intermediate_pages', False):
+        if self.get_param('dump_intermediate_pages', False):
             self.to_screen('Dumping request to ' + urlh.geturl())
             dump = base64.b64encode(webpage_bytes).decode('ascii')
             self._downloader.to_screen(dump)
-        if self._downloader.params.get('write_pages', False):
+        if self.get_param('write_pages', False):
             basen = '%s_%s' % (video_id, urlh.geturl())
             if len(basen) > 240:
                 h = '___' + hashlib.md5(basen.encode('utf-8')).hexdigest()
@@ -941,14 +942,22 @@ def _parse_json(self, json_string, video_id, transform_source=None, fatal=True):
             else:
                 self.report_warning(errmsg + str(ve))
 
-    def report_warning(self, msg, video_id=None):
+    def report_warning(self, msg, video_id=None, *args, **kwargs):
         idstr = '' if video_id is None else '%s: ' % video_id
         self._downloader.report_warning(
-            '[%s] %s%s' % (self.IE_NAME, idstr, msg))
+            '[%s] %s%s' % (self.IE_NAME, idstr, msg), *args, **kwargs)
 
-    def to_screen(self, msg):
+    def to_screen(self, msg, *args, **kwargs):
         """Print msg to screen, prefixing it with '[ie_name]'"""
-        self._downloader.to_screen('[%s] %s' % (self.IE_NAME, msg))
+        self._downloader.to_screen('[%s] %s' % (self.IE_NAME, msg), *args, **kwargs)
+
+    def write_debug(self, msg, *args, **kwargs):
+        self._downloader.write_debug('[%s] %s' % (self.IE_NAME, msg), *args, **kwargs)
+
+    def get_param(self, name, default=None, *args, **kwargs):
+        if self._downloader:
+            return self._downloader.params.get(name, default, *args, **kwargs)
+        return default
 
     def report_extraction(self, id_or_name):
         """Report information extraction."""
@@ -968,7 +977,7 @@ def report_login(self):
 
     def raise_login_required(
             self, msg='This video is only available for registered users', metadata_available=False):
-        if metadata_available and self._downloader.params.get('ignore_no_formats_error'):
+        if metadata_available and self.get_param('ignore_no_formats_error'):
             self.report_warning(msg)
         raise ExtractorError(
             '%s. Use --cookies, --username and --password or --netrc to provide account credentials' % msg,
@@ -977,13 +986,13 @@ def raise_login_required(
     def raise_geo_restricted(
             self, msg='This video is not available from your location due to geo restriction',
             countries=None, metadata_available=False):
-        if metadata_available and self._downloader.params.get('ignore_no_formats_error'):
+        if metadata_available and self.get_param('ignore_no_formats_error'):
             self.report_warning(msg)
         else:
             raise GeoRestrictedError(msg, countries=countries)
 
     def raise_no_formats(self, msg, expected=False, video_id=None):
-        if expected and self._downloader.params.get('ignore_no_formats_error'):
+        if expected and self.get_param('ignore_no_formats_error'):
             self.report_warning(msg, video_id)
         else:
             raise ExtractorError(msg, expected=expected, video_id=video_id)
@@ -1038,7 +1047,7 @@ def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, f
                 if mobj:
                     break
 
-        if not self._downloader.params.get('no_color') and compat_os_name != 'nt' and sys.stderr.isatty():
+        if not self.get_param('no_color') and compat_os_name != 'nt' and sys.stderr.isatty():
             _name = '\033[0;34m%s\033[0m' % name
         else:
             _name = name
@@ -1072,7 +1081,7 @@ def _get_netrc_login_info(self, netrc_machine=None):
         password = None
         netrc_machine = netrc_machine or self._NETRC_MACHINE
 
-        if self._downloader.params.get('usenetrc', False):
+        if self.get_param('usenetrc', False):
             try:
                 info = netrc.netrc().authenticators(netrc_machine)
                 if info is not None:
@@ -1096,15 +1105,11 @@ def _get_login_info(self, username_option='username', password_option='password'
         value.
         If there's no info available, return (None, None)
         """
-        if self._downloader is None:
-            return (None, None)
-
-        downloader_params = self._downloader.params
 
         # Attempt to use provided username and password or .netrc data
-        if downloader_params.get(username_option) is not None:
-            username = downloader_params[username_option]
-            password = downloader_params[password_option]
+        username = self.get_param(username_option)
+        if username is not None:
+            password = self.get_param(password_option)
         else:
             username, password = self._get_netrc_login_info(netrc_machine)
 
@@ -1117,12 +1122,10 @@ def _get_tfa_info(self, note='two-factor verification code'):
         currently just uses the command line option
         If there's no info available, return None
         """
-        if self._downloader is None:
-            return None
-        downloader_params = self._downloader.params
 
-        if downloader_params.get('twofactor') is not None:
-            return downloader_params['twofactor']
+        tfa = self.get_param('twofactor')
+        if tfa is not None:
+            return tfa
 
         return compat_getpass('Type %s and press [Return]: ' % note)
 
@@ -1683,12 +1686,12 @@ def calculate_preference(self, format):
 
     def _sort_formats(self, formats, field_preference=[]):
         if not formats:
-            if self._downloader.params.get('ignore_no_formats_error'):
+            if self.get_param('ignore_no_formats_error'):
                 return
             raise ExtractorError('No video formats found')
         format_sort = self.FormatSort()  # params and to_screen are taken from the downloader
         format_sort.evaluate_params(self._downloader.params, field_preference)
-        if self._downloader.params.get('verbose', False):
+        if self.get_param('verbose', False):
             format_sort.print_verbose_info(self._downloader.write_debug)
         formats.sort(key=lambda f: format_sort.calculate_preference(f))
 
@@ -1728,7 +1731,7 @@ def http_scheme(self):
         """ Either "http:" or "https:", depending on the user's preferences """
         return (
             'http:'
-            if self._downloader.params.get('prefer_insecure', False)
+            if self.get_param('prefer_insecure', False)
             else 'https:')
 
     def _proto_relative_url(self, url, scheme=None):
@@ -1922,7 +1925,7 @@ def _parse_m3u8_formats_and_subtitles(
         if '#EXT-X-FAXS-CM:' in m3u8_doc:  # Adobe Flash Access
             return [], {}
 
-        if (not self._downloader.params.get('allow_unplayable_formats')
+        if (not self.get_param('allow_unplayable_formats')
                 and re.search(r'#EXT-X-SESSION-KEY:.*?URI="skd://', m3u8_doc)):  # Apple FairPlay
             return [], {}
 
@@ -1935,7 +1938,7 @@ def _parse_m3u8_formats_and_subtitles(
             if re.match(r'^https?://', u)
             else compat_urlparse.urljoin(m3u8_url, u))
 
-        split_discontinuity = self._downloader.params.get('hls_split_discontinuity', False)
+        split_discontinuity = self.get_param('hls_split_discontinuity', False)
 
         # References:
         # 1. https://tools.ietf.org/html/draft-pantos-http-live-streaming-21
@@ -2478,7 +2481,7 @@ def _parse_mpd_formats_and_subtitles(
             http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip
          2. https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP
         """
-        if not self._downloader.params.get('dynamic_mpd', True):
+        if not self.get_param('dynamic_mpd', True):
             if mpd_doc.get('type') == 'dynamic':
                 return [], {}
 
@@ -2548,7 +2551,7 @@ def extract_Initialization(source):
                         extract_Initialization(segment_template)
             return ms_info
 
-        skip_unplayable = not self._downloader.params.get('allow_unplayable_formats')
+        skip_unplayable = not self.get_param('allow_unplayable_formats')
 
         mpd_duration = parse_duration(mpd_doc.get('mediaPresentationDuration'))
         formats = []
@@ -2797,7 +2800,7 @@ def _parse_ism_formats_and_subtitles(self, ism_doc, ism_url, ism_id=None):
         """
         if ism_doc.get('IsLive') == 'TRUE':
             return [], {}
-        if (not self._downloader.params.get('allow_unplayable_formats')
+        if (not self.get_param('allow_unplayable_formats')
                 and ism_doc.find('Protection') is not None):
             return [], {}
 
@@ -3402,8 +3405,8 @@ def is_suitable(self, age_limit):
         return not any_restricted
 
     def extract_subtitles(self, *args, **kwargs):
-        if (self._downloader.params.get('writesubtitles', False)
-                or self._downloader.params.get('listsubtitles')):
+        if (self.get_param('writesubtitles', False)
+                or self.get_param('listsubtitles')):
             return self._get_subtitles(*args, **kwargs)
         return {}
 
@@ -3438,8 +3441,8 @@ def _merge_subtitles(cls, *dicts, **kwargs):
         return target
 
     def extract_automatic_captions(self, *args, **kwargs):
-        if (self._downloader.params.get('writeautomaticsub', False)
-                or self._downloader.params.get('listsubtitles')):
+        if (self.get_param('writeautomaticsub', False)
+                or self.get_param('listsubtitles')):
             return self._get_automatic_captions(*args, **kwargs)
         return {}
 
@@ -3447,9 +3450,9 @@ def _get_automatic_captions(self, *args, **kwargs):
         raise NotImplementedError('This method must be implemented by subclasses')
 
     def mark_watched(self, *args, **kwargs):
-        if (self._downloader.params.get('mark_watched', False)
+        if (self.get_param('mark_watched', False)
                 and (self._get_login_info()[0] is not None
-                     or self._downloader.params.get('cookiefile') is not None)):
+                     or self.get_param('cookiefile') is not None)):
             self._mark_watched(*args, **kwargs)
 
     def _mark_watched(self, *args, **kwargs):
@@ -3457,7 +3460,7 @@ def _mark_watched(self, *args, **kwargs):
 
     def geo_verification_headers(self):
         headers = {}
-        geo_verification_proxy = self._downloader.params.get('geo_verification_proxy')
+        geo_verification_proxy = self.get_param('geo_verification_proxy')
         if geo_verification_proxy:
             headers['Ytdl-request-proxy'] = geo_verification_proxy
         return headers
index 1a5dcbd8b252ea46a41667905ef55ddfb535254e..05126965233f5f5502df095fd1099bf2053db16e 100644 (file)
@@ -26,7 +26,7 @@ def _real_extract(self, url):
             'That doesn\'t make any sense. '
             'Simply remove the parameter in your command or configuration.'
         ) % url
-        if not self._downloader.params.get('verbose'):
+        if not self.get_param('verbose'):
             msg += ' Add -v to the command line to see what arguments and configuration yt-dlp has'
         raise ExtractorError(msg, expected=True)
 
index 4fa08a60695c94786c265753e69a77bbf643b5f0..216e71311423ad1fa38bfac00aca6ead673c5552 100644 (file)
@@ -81,7 +81,7 @@ def _download_json(self, url, *args, **kwargs):
     def _real_extract(self, url):
         video_id = self._match_id(url)
 
-        geo_bypass_country = self._downloader.params.get('geo_bypass_country', None)
+        geo_bypass_country = self.get_param('geo_bypass_country', None)
         countries = orderedSet((geo_bypass_country, 'US', 'AU', 'CA', 'AS', 'FM', 'GU', 'MP', 'PR', 'PW', 'MH', 'VI', ''))
         num_countries, num = len(countries) - 1, 0
 
@@ -128,8 +128,8 @@ def _real_extract(self, url):
             if isinstance(media.get('MediaURLs'), list):
                 break
 
-        ignore_no_formats = self._downloader.params.get('ignore_no_formats_error')
-        allow_unplayable_formats = self._downloader.params.get('allow_unplayable_formats')
+        ignore_no_formats = self.get_param('ignore_no_formats_error')
+        allow_unplayable_formats = self.get_param('allow_unplayable_formats')
 
         if not media or (not media.get('MediaURLs') and not ignore_no_formats):
             raise ExtractorError(
index b8529050c45c8ee1479e2624ba26aac3f002b9fe..633d39adc8a69f2f97e9d219cfc0617366dc31ad 100644 (file)
@@ -42,7 +42,7 @@ def _set_dailymotion_cookie(self, name, value):
     def _real_initialize(self):
         cookies = self._get_dailymotion_cookies()
         ff = self._get_cookie_value(cookies, 'ff')
-        self._FAMILY_FILTER = ff == 'on' if ff else age_restricted(18, self._downloader.params.get('age_limit'))
+        self._FAMILY_FILTER = ff == 'on' if ff else age_restricted(18, self.get_param('age_limit'))
         self._set_dailymotion_cookie('ff', 'on' if self._FAMILY_FILTER else 'off')
 
     def _call_api(self, object_type, xid, object_fields, note, filter_extra=None):
@@ -207,14 +207,14 @@ def _real_extract(self, url):
         video_id, playlist_id = re.match(self._VALID_URL, url).groups()
 
         if playlist_id:
-            if not self._downloader.params.get('noplaylist'):
+            if not self.get_param('noplaylist'):
                 self.to_screen('Downloading playlist %s - add --no-playlist to just download video' % playlist_id)
                 return self.url_result(
                     'http://www.dailymotion.com/playlist/' + playlist_id,
                     'DailymotionPlaylist', playlist_id)
             self.to_screen('Downloading just video %s because of --no-playlist' % video_id)
 
-        password = self._downloader.params.get('videopassword')
+        password = self.get_param('videopassword')
         media = self._call_api(
             'media', video_id, '''... on Video {
       %s
@@ -232,7 +232,7 @@ def _real_extract(self, url):
       audienceCount
       isOnAir
     }''' % (self._COMMON_MEDIA_FIELDS, self._COMMON_MEDIA_FIELDS), 'Downloading media JSON metadata',
-            'password: "%s"' % self._downloader.params.get('videopassword') if password else None)
+            'password: "%s"' % self.get_param('videopassword') if password else None)
         xid = media['xid']
 
         metadata = self._download_json(
index 13709557754afc133c2654e202d52c32d5d85d66..b0911cf94349d2adc6d688b3f61f74b7b13b6675 100644 (file)
@@ -158,7 +158,7 @@ def _check_clip(self, url, list_id):
         query_dict = compat_parse_qs(compat_urlparse.urlparse(url).query)
         if 'clipid' in query_dict:
             clip_id = query_dict['clipid'][0]
-            if self._downloader.params.get('noplaylist'):
+            if self.get_param('noplaylist'):
                 self.to_screen('Downloading just video %s because of --no-playlist' % clip_id)
                 return self.url_result(DaumClipIE._URL_TEMPLATE % clip_id, 'DaumClip')
             else:
index 3b1833c8d92a6bfc491f0c41b030788582c49107..3f6e007fcee483844a453fd8066e0a8b15ed93c0 100644 (file)
@@ -13,7 +13,7 @@
 
 class DeezerBaseInfoExtractor(InfoExtractor):
     def get_data(self, url):
-        if not self._downloader.params.get('test'):
+        if not self.get_param('test'):
             self.report_warning('For now, this extractor only supports the 30 second previews. Patches welcome!')
 
         mobj = re.match(self._VALID_URL, url)
index 2153fe6b3f958e315a461d28c3b0e57f88ea2498..79025fd0ea72e3aa1a18d07f90810ce291ac8d40 100644 (file)
@@ -2370,7 +2370,7 @@ def _real_extract(self, url):
 
         parsed_url = compat_urlparse.urlparse(url)
         if not parsed_url.scheme:
-            default_search = self._downloader.params.get('default_search')
+            default_search = self.get_param('default_search')
             if default_search is None:
                 default_search = 'fixup_error'
 
@@ -2461,8 +2461,8 @@ def _real_extract(self, url):
             info_dict['subtitles'] = subtitles
             return info_dict
 
-        if not self._downloader.params.get('test', False) and not is_intentional:
-            force = self._downloader.params.get('force_generic_extractor', False)
+        if not self.get_param('test', False) and not is_intentional:
+            force = self.get_param('force_generic_extractor', False)
             self.report_warning(
                 '%s on generic information extractor.' % ('Forcing' if force else 'Falling back'))
 
index 3dbe759be3c8cfb944e95cc8666621241e995280..dd8fae5366903811b2a230a9f204b71a95a7a57e 100644 (file)
@@ -96,7 +96,7 @@ def _real_extract(self, url):
         video = self._download_json(
             'http://api.globovideos.com/videos/%s/playlist' % video_id,
             video_id)['videos'][0]
-        if not self._downloader.params.get('allow_unplayable_formats') and video.get('encrypted') is True:
+        if not self.get_param('allow_unplayable_formats') and video.get('encrypted') is True:
             raise ExtractorError('This video is DRM protected.', expected=True)
 
         title = video['title']
index 22cccf2b265dbc0d3853ef597ea6e4482de9b600..d497b50c1bc65afc3657b53883f7aec62251bf79 100644 (file)
@@ -141,7 +141,7 @@ def _real_extract(self, url):
 
         title = video_data['title']
 
-        if not self._downloader.params.get('allow_unplayable_formats') and video_data.get('drmProtected'):
+        if not self.get_param('allow_unplayable_formats') and video_data.get('drmProtected'):
             raise ExtractorError('This video is DRM protected.', expected=True)
 
         headers = {'Referer': url}
index e11f92053bce3764695d87fe786980abeddae0df..1e43ec95beabf517ffe2a938b7934387e7bf3b9a 100644 (file)
@@ -65,7 +65,7 @@ def _real_extract(self, url):
         domain, media_type, media_id, playlist_id = re.match(self._VALID_URL, url).groups()
 
         if playlist_id:
-            if self._downloader.params.get('noplaylist'):
+            if self.get_param('noplaylist'):
                 self.to_screen('Downloading just video %s because of --no-playlist' % media_id)
             else:
                 self.to_screen('Downloading playlist %s - add --no-playlist to just download video' % playlist_id)
index 064279663dd72775aa0fb452a92916dc7d41d0b2..c167ee500d11eb4411dbd81668643579ba810906 100644 (file)
@@ -165,7 +165,7 @@ def _real_extract(self, url):
             content_format = f.get('content_format')
             if not f_url:
                 continue
-            if (not self._downloader.params.get('allow_unplayable_formats')
+            if (not self.get_param('allow_unplayable_formats')
                     and ('-MDRM-' in content_format or '-FPS-' in content_format)):
                 continue
             formats.append({
index f109160819124d930a76f742ba58cd0bd7ca7ccf..4ab0567a549f2f9612728f759855ef50640ec133 100644 (file)
@@ -309,7 +309,7 @@ def sign_url(unsigned_url):
             if f.get('fileExt') == 'chun':
                 continue
             # DRM-protected video, cannot be decrypted
-            if not self._downloader.params.get('allow_unplayable_formats') and f.get('fileExt') == 'wvm':
+            if not self.get_param('allow_unplayable_formats') and f.get('fileExt') == 'wvm':
                 continue
             if not f.get('fileExt'):
                 # QT indicates QuickTime; some videos have broken fileExt
index d1f0edc6bd489cfd7eb51b463099b7c09a1e272b..369141d6797b967dcb3ffdacd569697f094c5f28 100644 (file)
@@ -98,7 +98,7 @@ def _extract_info(self, pc, mobile, i, referer):
             stream_url = stream.get('url')
             if not stream_url or stream_url in urls:
                 continue
-            if not self._downloader.params.get('allow_unplayable_formats') and stream.get('drmProtected'):
+            if not self.get_param('allow_unplayable_formats') and stream.get('drmProtected'):
                 continue
             urls.append(stream_url)
             ext = determine_ext(stream_url)
@@ -163,7 +163,7 @@ def _extract_info(self, pc, mobile, i, referer):
             if not media_url or media_url in urls:
                 continue
             if (format_id in ('Widevine', 'SmoothStreaming')
-                    and not self._downloader.params.get('allow_unplayable_formats', False)):
+                    and not self.get_param('allow_unplayable_formats', False)):
                 continue
             urls.append(media_url)
             ext = determine_ext(media_url)
index 337b1b15cf9d783750fa225b5538edfbc1fcfde2..18d237ef9e92a87ce700d266c665d648d6c22358 100644 (file)
@@ -71,7 +71,7 @@ def _real_extract(self, url):
 
         video_id = self._match_id(url)
 
-        noplaylist = self._downloader.params.get('noplaylist')
+        noplaylist = self.get_param('noplaylist')
         noplaylist_prompt = True
         if 'force_noplaylist' in data:
             noplaylist = data['force_noplaylist']
index a1dc1dde7baa260f4bfc481bab5e21f39fdb0497..366e5d645b7d24b13d7658f306480a121c2eb5ce 100644 (file)
@@ -167,7 +167,7 @@ def _real_extract(self, url):
         display_id = self._match_id(url)
         collection_id = compat_parse_qs(compat_urllib_parse_urlparse(url).query).get('collection', [None])[0]
         if collection_id:
-            if self._downloader.params.get('noplaylist'):
+            if self.get_param('noplaylist'):
                 self.to_screen('Downloading just video %s because of --no-playlist' % display_id)
             else:
                 self.to_screen('Downloading playlist %s - add --no-playlist to just download video' % collection_id)
index 978a05841ce68161330f9db24169dd330e51efc1..7652371b3cb56724d464a3c7e1a0eea0904d03c9 100644 (file)
@@ -405,7 +405,7 @@ def _real_extract(self, url):
         name = info['name']
         description = info['description']
 
-        if not info['songs'] or self._downloader.params.get('noplaylist'):
+        if not info['songs'] or self.get_param('noplaylist'):
             if info['songs']:
                 self.to_screen(
                     'Downloading just the main audio %s because of --no-playlist'
index 4879a65baddb2691a06c9f23f497aefe1e82053e..71fde114c6019ace87749ca5b9c3e57e49d83625 100644 (file)
@@ -34,7 +34,7 @@ def _real_extract(self, url):
                 '$include': '[HasClosedCaptions]',
             })
 
-        if (not self._downloader.params.get('allow_unplayable_formats')
+        if (not self.get_param('allow_unplayable_formats')
                 and try_get(content_package, lambda x: x['Constraints']['Security']['Type'])):
             raise ExtractorError('This video is DRM protected.', expected=True)
 
index fc3a398ad8502f60763b7f440321b6911d402822..43b9c4e7eab9655c48a6fa808803ca509f9bbe6c 100644 (file)
@@ -66,7 +66,7 @@ def _real_extract(self, url):
 
         video_data = common_data['video']
 
-        if not self._downloader.params.get('allow_unplayable_formats') and video_data.get('drm'):
+        if not self.get_param('allow_unplayable_formats') and video_data.get('drm'):
             raise ExtractorError('This video is DRM protected.', expected=True)
 
         brightcove_id = video_data.get('brightcoveId') or 'ref:' + video_data['referenceId']
index 573a89092cdf0cef4495238d4f07cece8456f083..6984b76a9e31326de4a1cdbb3dd3f2d4c55fa6e6 100644 (file)
@@ -246,7 +246,7 @@ def _get_info(self, url, video_id):
                 })
 
         if not formats:
-            if not self._downloader.params.get('allow_unplayable_formats') and drm:
+            if not self.get_param('allow_unplayable_formats') and drm:
                 self.raise_no_formats('This video is DRM protected.', expected=True)
             return
 
index e55b2ac89bb7b6449d0ac51f1092d30742b3606c..219ac349ed2426bf431d7b69d0c0d7e3c7dfb8ae 100644 (file)
@@ -182,7 +182,7 @@ def _real_extract(self, url):
         video_id = remove_start(current_clip_info['ckmId'], 'mvp:')
         video_name = url_basename(current_clip_info['url'])
 
-        if self._downloader.params.get('noplaylist'):
+        if self.get_param('noplaylist'):
             self.to_screen(
                 'Downloading just video %s because of --no-playlist' % video_name)
             return self._extract_from_id(video_id, webpage)
index 9545adebf86e201263420a38b27ea67b72cb1786..9f4899c09ccc0e3988b794de4c83780e608411b0 100644 (file)
@@ -79,7 +79,7 @@ def extract_entry(source):
                 formats.extend(self._extract_m3u8_formats(
                     m3u8_url, video_id, 'mp4', entry_protocol='m3u8_native',
                     m3u8_id='hls', fatal=False))
-            if not formats and not self._downloader.params.get('ignore_no_formats'):
+            if not formats and not self.get_param('ignore_no_formats'):
                 return
             self._sort_formats(formats)
             return {
index 2d63855df55bc4137644beaf688f384acddea333..d494753e685a9dbd8424e4c790e83cef8bd5ef3e 100644 (file)
@@ -337,11 +337,11 @@ def _real_extract(self, url):
         # In order to minimize the number of calls to ViewClip API and reduce
         # the probability of being throttled or banned by Pluralsight we will request
         # only single format until formats listing was explicitly requested.
-        if self._downloader.params.get('listformats', False):
+        if self.get_param('listformats', False):
             allowed_qualities = ALLOWED_QUALITIES
         else:
             def guess_allowed_qualities():
-                req_format = self._downloader.params.get('format') or 'best'
+                req_format = self.get_param('format') or 'best'
                 req_format_split = req_format.split('-', 1)
                 if len(req_format_split) > 1:
                     req_ext, req_quality = req_format_split
@@ -349,7 +349,7 @@ def guess_allowed_qualities():
                     for allowed_quality in ALLOWED_QUALITIES:
                         if req_ext == allowed_quality.ext and req_quality in allowed_quality.qualities:
                             return (AllowedQuality(req_ext, (req_quality, )), )
-                req_ext = 'webm' if self._downloader.params.get('prefer_free_formats') else 'mp4'
+                req_ext = 'webm' if self.get_param('prefer_free_formats') else 'mp4'
                 return (AllowedQuality(req_ext, (best_quality, )), )
             allowed_qualities = guess_allowed_qualities()
 
index 521c70cd1c3358d0d293ba9e572f5c4c15fb0e06..6e3f48a9ddbd38fbd995ff27b4616a582b0932ed 100644 (file)
@@ -109,7 +109,7 @@ def _to_ad_free_formats(self, video_id, formats, subtitles):
         if ad_free_formats:
             formats, subtitles = ad_free_formats, ad_free_subtitles
         else:
-            self._downloader.report_warning('Unable to find ad-free formats')
+            self.report_warning('Unable to find ad-free formats')
         return formats, subtitles
 
     def _get_video_info(self, video_json, slug, series_name=None):
index ec8148407b9df20f2fab382cb26bf0fe1a858b13..8750e0e0d39b940169fc31428b9bb9d475f3727f 100644 (file)
@@ -112,7 +112,7 @@ def _real_extract(self, url):
         }
 
         # API call can be avoided entirely if we are listing formats
-        if self._downloader.params.get('listformats', False):
+        if self.get_param('listformats', False):
             return info
 
         webpage = self._download_webpage(url, video_id)
index 307ab81e93db7b7cfb3e4f3afc63bd14d831bdd4..707146be7e53e2a7413955027126b033286ee286 100644 (file)
@@ -34,7 +34,7 @@ def _extract_video_info(self, url, clip_id):
                 'ids': clip_id,
             })[0]
 
-        if not self._downloader.params.get('allow_unplayable_formats') and video.get('is_protected') is True:
+        if not self.get_param('allow_unplayable_formats') and video.get('is_protected') is True:
             raise ExtractorError('This video is DRM protected.', expected=True)
 
         formats = []
index 64421b1521ff395d142e63732cac0d02b377dc0e..199253c4a14161152594d0b0d3bddf78e15f3529 100644 (file)
@@ -275,7 +275,7 @@ def _real_extract(self, url):
         media = self._download_json(
             base + '.json', video_id, 'Downloading video JSON')
 
-        if not self._downloader.params.get('allow_unplayable_formats'):
+        if not self.get_param('allow_unplayable_formats'):
             if try_get(
                     media,
                     (lambda x: x['rights_management']['rights']['drm'],
index 2bb0acd5a59f0fb09c3c32736943f4c7f8d248dd..c6ca4cd1005cb891d34a70d3abfc845ff876420d 100644 (file)
@@ -125,7 +125,7 @@ def _real_extract(self, url):
                 })
 
         mpd_url = data.get('urlDash')
-        if mpd_url and (self._downloader.params.get('allow_unplayable_formats') or not data.get('drm')):
+        if mpd_url and (self.get_param('allow_unplayable_formats') or not data.get('drm')):
             formats.extend(self._extract_mpd_formats(
                 mpd_url, media_id, mpd_id='dash', fatal=False))
 
index 5030c01cd6f6f6beb072684039521378ddd976f9..6a78441ef8963390eaed0df87e2ac5c4757544b0 100644 (file)
@@ -200,7 +200,7 @@ def pv(name):
                 return node.get('value')
 
         if not formats:
-            if (not self._downloader.params.get('allow_unplayable_formats')
+            if (not self.get_param('allow_unplayable_formats')
                     and xpath_text(video_xml, './Clip/DRM', default=None)):
                 self.raise_no_formats('This video is DRM protected.', expected=True)
             ns_st_cds = pv('ns_st_cds')
index 5768199bcc87ffb418e2cd477c85924212665d62..8cbb620ed944895d8cb3096e1922c176cdd7dbb5 100644 (file)
@@ -114,7 +114,7 @@ def _real_extract(self, url):
         playout = self._call_api(
             'playout/new/url/' + video_id, video_id)['playout']
 
-        if not self._downloader.params.get('allow_unplayable_formats') and playout.get('drm'):
+        if not self.get_param('allow_unplayable_formats') and playout.get('drm'):
             raise ExtractorError('This video is DRM protected.', expected=True)
 
         formats = self._extract_m3u8_formats(re.sub(
index ec95810e35e4029c346adaa40de610bd9ed14450..5cfd109bba0b0bf281fd4b177fab1cfacc77d1c3 100644 (file)
@@ -75,7 +75,7 @@ def _real_extract(self, url):
         video_id = self._match_id(url)
         content = self._call_api(
             '1.5', 'IN/CONTENT/VIDEOURL/VOD/' + video_id, video_id)
-        if not self._downloader.params.get('allow_unplayable_formats') and content.get('isEncrypted'):
+        if not self.get_param('allow_unplayable_formats') and content.get('isEncrypted'):
             raise ExtractorError('This video is DRM protected.', expected=True)
         dash_url = content['videoURL']
         headers = {
index e70d1a477840c25a7301e8e9af4f34304bc1233d..2129a5670fdbc7817441144236c0b3a5d5b906d8 100644 (file)
@@ -63,7 +63,7 @@ def _real_extract(self, url):
         if len(videos) > 1:
             playlist_id = compat_parse_qs(compat_urllib_parse_urlparse(url).query).get('playlistId', [None])[0]
             if playlist_id:
-                if self._downloader.params.get('noplaylist'):
+                if self.get_param('noplaylist'):
                     videos = [videos[int(playlist_id)]]
                     self.to_screen('Downloading just a single video because of --no-playlist')
                 else:
@@ -77,7 +77,7 @@ def entries():
                         continue
                     formats = self._extract_m3u8_formats(
                         video_url.replace('.smil', '.m3u8'), video_id, 'mp4', fatal=False)
-                    if not formats and not self._downloader.params.get('ignore_no_formats'):
+                    if not formats and not self.get_param('ignore_no_formats'):
                         continue
                     yield {
                         'id': video_id,
index c70bdefe28dfcce08ad1c44d282312f624c8064a..9518f83f12d04a6e462d913e8e53f73d9cf88fb0 100644 (file)
@@ -139,7 +139,7 @@ def _real_extract(self, url):
                                         'format_id': ext + quality,
                                         'url': video_url,
                                     })
-                if not formats and not self._downloader.params.get('ignore_no_formats'):
+                if not formats and not self.get_param('ignore_no_formats'):
                     continue
                 entry['formats'] = formats
                 entries.append(entry)
index fe18410812885b02b7f66aa4e3b97886ce4d8776..3f4f6e827a6cf305efbf38c88198e21691a6ecc7 100644 (file)
@@ -153,7 +153,7 @@ def _real_extract(self, url):
                 })
         if not formats:
             for meta in (info.get('Metas') or []):
-                if (not self._downloader.params.get('allow_unplayable_formats')
+                if (not self.get_param('allow_unplayable_formats')
                         and meta.get('Key') == 'Encryption' and meta.get('Value') == '1'):
                     self.raise_no_formats(
                         'This video is DRM protected.', expected=True)
index aba87051a00c3caa35d18c96c43c59544223c29d..6c84c211c97e824045f896f48f2ea392b4132d6d 100644 (file)
@@ -74,7 +74,7 @@ def _real_extract(self, url):
             })
         # IsDrm does not necessarily mean the video is DRM protected (see
         # https://github.com/ytdl-org/youtube-dl/issues/13994).
-        if not self._downloader.params.get('allow_unplayable_formats') and metadata.get('IsDrm'):
+        if not self.get_param('allow_unplayable_formats') and metadata.get('IsDrm'):
             self.report_warning('This video is probably DRM protected.', path)
         video_id = metadata['IdMedia']
         details = metadata['Details']
index 9b90a2b26b31a749771add8c433f56ab41b03b00..fc87a69afe4550cfdb5e1e02319f636564d6d7ab 100644 (file)
@@ -69,7 +69,7 @@ def make_urls(proto, suffix):
             if formats:
                 break
         else:
-            if not self._downloader.params.get('allow_unplayable_formats') and info.get('isDrm'):
+            if not self.get_param('allow_unplayable_formats') and info.get('isDrm'):
                 raise ExtractorError(
                     'Video %s is DRM protected' % video_id, expected=True)
             if info.get('geoblocked'):
index 8d8aa65d2090c12ae0865d1fa8e5bdb63cefcb0a..27a9621fe3891ed7a5da9e7b163cbb599cc34eb1 100644 (file)
@@ -59,7 +59,7 @@ class TwitCastingIE(InfoExtractor):
     def _real_extract(self, url):
         uploader_id, video_id = re.match(self._VALID_URL, url).groups()
 
-        video_password = self._downloader.params.get('videopassword')
+        video_password = self.get_param('videopassword')
         request_data = None
         if video_password:
             request_data = urlencode_postdata({
index 53b6d398a1d7102bb40898404be1e15d2234a612..e5cbdb6a61cf9cf8fc4aa974eda325352fef8452 100644 (file)
@@ -324,7 +324,7 @@ def add_format(format_id, format_dict, protocol='http'):
                 # Despite CODECS metadata in m3u8 all video-only formats
                 # are actually video+audio
                 for f in m3u8_formats:
-                    if not self._downloader.params.get('allow_unplayable_formats') and '_drm/index_' in f['url']:
+                    if not self.get_param('allow_unplayable_formats') and '_drm/index_' in f['url']:
                         continue
                     if f.get('acodec') == 'none' and f.get('vcodec') != 'none':
                         f['acodec'] = None
index 61a1d9b6895d9b96cb2c1049e65ea924e626473b..785dcc457ce532170cff20e44a29e69dcf1e56cb 100644 (file)
@@ -76,7 +76,7 @@ def _login(self):
             raise ExtractorError('Unable to log in')
 
     def _get_video_password(self):
-        password = self._downloader.params.get('videopassword')
+        password = self.get_param('videopassword')
         if password is None:
             raise ExtractorError(
                 'This video is protected by a password, use the --video-password option',
@@ -603,7 +603,7 @@ def _try_album_password(self, url):
             album_id, headers={'Authorization': 'jwt ' + jwt},
             query={'fields': 'description,name,privacy'})
         if try_get(album, lambda x: x['privacy']['view']) == 'password':
-            password = self._downloader.params.get('videopassword')
+            password = self.get_param('videopassword')
             if not password:
                 raise ExtractorError(
                     'This album is protected by a password, use the --video-password option',
@@ -1058,7 +1058,7 @@ def _real_extract(self, url):
             query={'fields': 'description,name,privacy'})
         hashed_pass = None
         if try_get(album, lambda x: x['privacy']['view']) == 'password':
-            password = self._downloader.params.get('videopassword')
+            password = self.get_param('videopassword')
             if not password:
                 raise ExtractorError(
                     'This album is protected by a password, use the --video-password option',
index 3292d553e85101a650e12644d6a40ddff78489aa..b1e5f0af73108e8614bd94acd3eadabcd115159e 100644 (file)
@@ -287,7 +287,7 @@ def _real_extract(self, url):
             raise ExtractorError('This video is not available in your region.', expected=True)
 
         series_id = video_data.get('series_id')
-        if not self._downloader.params.get('noplaylist') and not idata.get('force_noplaylist'):
+        if not self.get_param('noplaylist') and not idata.get('force_noplaylist'):
             self.to_screen('Downloading playlist %s - add --no-playlist to just download video' % series_id)
             series = product_data.get('series', {})
             product = series.get('product')
@@ -308,7 +308,7 @@ def _real_extract(self, url):
 
                 return self.playlist_result(entries, series_id, series.get('name'), series.get('description'))
 
-        if self._downloader.params.get('noplaylist'):
+        if self.get_param('noplaylist'):
             self.to_screen('Downloading just video %s because of --no-playlist' % video_id)
 
         duration_limit = False
index d1cfd4510665bb7e4f9772185137e2c988e78bc9..9cfa082db0acf9cdbce96ae4527c08c4ea4f5ef0 100644 (file)
@@ -136,7 +136,7 @@ def _real_extract(self, url):
             'author{nickname},channel{channelCode,channelName},officialVideo{commentCount,exposeStatus,likeCount,playCount,playTime,status,title,type,vodId},playlist{playlistSeq,totalCount,name}')
 
         playlist = post.get('playlist')
-        if not playlist or self._downloader.params.get('noplaylist'):
+        if not playlist or self.get_param('noplaylist'):
             if playlist:
                 self.to_screen(
                     'Downloading just video %s because of --no-playlist'
index 507a28febb1b85bc7887df5782e24cbad7b7a35e..baa87e27a2a31fc2f805f6f21ed4914e3868d26d 100644 (file)
@@ -41,7 +41,7 @@ def _real_extract(self, url):
         m3u8_url = urljoin(url, self._search_regex(
             r'file\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage, 'm3u8 url',
             group='url'))
-        if not self._downloader.params.get('allow_unplayable_formats'):
+        if not self.get_param('allow_unplayable_formats'):
             # https://docs.microsoft.com/en-us/azure/media-services/previous/media-services-content-protection-overview#streaming-urls
             encryption = self._search_regex(
                 r'encryption%3D(c(?:enc|bc(?:s-aapl)?))',
index 880c896875373bb13fb1ea9a373f87283c7e3a6b..b5057991533f7b5fb9c4f751bf551e857df15449 100644 (file)
@@ -160,7 +160,7 @@ def _real_extract(self, url):
             'client_ts': time.time() / 1000,
         }
 
-        video_password = self._downloader.params.get('videopassword')
+        video_password = self.get_param('videopassword')
         if video_password:
             basic_data_params['password'] = video_password
 
index 2bd050797c149e8327042e36bd3190ed9d1ec8af..5cbaf46dc9451c23082bacb30eb4b2442181a2eb 100644 (file)
@@ -88,9 +88,9 @@ def _login(self):
         username, password = self._get_login_info()
         # No authentication to be performed
         if username is None:
-            if self._LOGIN_REQUIRED and self._downloader.params.get('cookiefile') is None:
+            if self._LOGIN_REQUIRED and self.get_param('cookiefile') is None:
                 raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True)
-            # if self._downloader.params.get('cookiefile'):  # TODO remove 'and False' later - too many people using outdated cookies and open issues, remind them.
+            # if self.get_param('cookiefile'):  # TODO remove 'and False' later - too many people using outdated cookies and open issues, remind them.
             #     self.to_screen('[Cookies] Reminder - Make sure to always use up to date cookies!')
             return True
 
@@ -1460,7 +1460,7 @@ def _decrypt_signature(self, s, video_id, player_url):
                 )
                 self._player_cache[player_id] = func
             func = self._player_cache[player_id]
-            if self._downloader.params.get('youtube_print_sig_code'):
+            if self.get_param('youtube_print_sig_code'):
                 self._print_sig_code(func, s)
             return func(s)
         except Exception as e:
@@ -1690,7 +1690,7 @@ def extract_thread(parent_renderer):
             if not continuation:
                 break
             headers = self._generate_api_headers(ytcfg, identity_token, account_syncid, visitor_data)
-            retries = self._downloader.params.get('extractor_retries', 3)
+            retries = self.get_param('extractor_retries', 3)
             count = -1
             last_error = None
 
@@ -1948,7 +1948,7 @@ def get_text(x):
         video_description = video_details.get('shortDescription')
 
         if not smuggled_data.get('force_singlefeed', False):
-            if not self._downloader.params.get('noplaylist'):
+            if not self.get_param('noplaylist'):
                 multifeed_metadata_list = try_get(
                     player_response,
                     lambda x: x['multicamera']['playerLegacyMulticameraRenderer']['metadataList'],
@@ -2092,7 +2092,7 @@ def feed_entry(name):
                         f['format_id'] = itag
                 formats.append(f)
 
-        if self._downloader.params.get('youtube_include_dash_manifest', True):
+        if self.get_param('youtube_include_dash_manifest', True):
             for sd in (streaming_data, ytm_streaming_data):
                 dash_manifest_url = sd.get('dashManifestUrl')
                 if dash_manifest_url:
@@ -2114,7 +2114,7 @@ def feed_entry(name):
                         formats.append(f)
 
         if not formats:
-            if not self._downloader.params.get('allow_unplayable_formats') and streaming_data.get('licenseInfos'):
+            if not self.get_param('allow_unplayable_formats') and streaming_data.get('licenseInfos'):
                 self.raise_no_formats(
                     'This video is DRM protected.', expected=True)
             pemr = try_get(
@@ -2473,8 +2473,8 @@ def chapter_time(mmlir):
             is_unlisted=None if is_private is None else is_unlisted)
 
         # get xsrf for annotations or comments
-        get_annotations = self._downloader.params.get('writeannotations', False)
-        get_comments = self._downloader.params.get('getcomments', False)
+        get_annotations = self.get_param('writeannotations', False)
+        get_comments = self.get_param('getcomments', False)
         if get_annotations or get_comments:
             xsrf_token = None
             ytcfg = self._extract_ytcfg(video_id, webpage)
@@ -3475,7 +3475,7 @@ def _extract_response(self, item_id, query, note='Downloading API JSON', headers
         response = None
         last_error = None
         count = -1
-        retries = self._downloader.params.get('extractor_retries', 3)
+        retries = self.get_param('extractor_retries', 3)
         if check_get_keys is None:
             check_get_keys = []
         while count < retries:
@@ -3519,7 +3519,7 @@ def _extract_response(self, item_id, query, note='Downloading API JSON', headers
         return response
 
     def _extract_webpage(self, url, item_id):
-        retries = self._downloader.params.get('extractor_retries', 3)
+        retries = self.get_param('extractor_retries', 3)
         count = -1
         last_error = 'Incomplete yt initial data recieved'
         while count < retries:
@@ -3559,7 +3559,7 @@ def __real_extract(self, url):
         item_id = self._match_id(url)
         url = compat_urlparse.urlunparse(
             compat_urlparse.urlparse(url)._replace(netloc='www.youtube.com'))
-        compat_opts = self._downloader.params.get('compat_opts', [])
+        compat_opts = self.get_param('compat_opts', [])
 
         # This is not matched in a channel page with a tab selected
         mobj = re.match(r'(?P<pre>%s)(?P<post>/?(?![^#?]).*$)' % self._VALID_URL, url)
@@ -3584,7 +3584,7 @@ def __real_extract(self, url):
             url = 'https://www.youtube.com/playlist?list=%s' % playlist_id
 
         if video_id and playlist_id:
-            if self._downloader.params.get('noplaylist'):
+            if self.get_param('noplaylist'):
                 self.to_screen('Downloading just video %s because of --no-playlist' % video_id)
                 return self.url_result(video_id, ie=YoutubeIE.ie_key(), video_id=video_id)
             self.to_screen('Downloading playlist %s; add --no-playlist to just download video %s' % (playlist_id, video_id))
index db073d91da9466a08d03835be43159a249f5913e..6579f5ea4cd91fde41dd46751811bafb44559d3b 100644 (file)
@@ -35,7 +35,7 @@ def _real_extract(self, url):
         except ExtractorError:
             form = None
         if form:
-            password = self._downloader.params.get('videopassword')
+            password = self.get_param('videopassword')
             if not password:
                 raise ExtractorError(
                     'This video is protected by a passcode, use the --video-password option', expected=True)