MCPcopy
hub / github.com/yt-dlp/yt-dlp / _download_webpage

Method _download_webpage

yt_dlp/extractor/common.py:1175–1205  ·  view source on GitHub ↗

Return the data of the page as a string. Keyword arguments: tries -- number of tries timeout -- sleep interval between tries See _download_webpage_handle docstring for other arguments specification.

(
            self, url_or_request, video_id, note=None, errnote=None,
            fatal=True, tries=1, timeout=NO_DEFAULT, *args, **kwargs)

Source from the content-addressed store, hash-verified

1173 __download_webpage = __create_download_methods('webpage', None, None, None, 'data of the page as a string')[1]
1174
1175 def _download_webpage(
1176 self, url_or_request, video_id, note=None, errnote=None,
1177 fatal=True, tries=1, timeout=NO_DEFAULT, *args, **kwargs):
1178 """
1179 Return the data of the page as a string.
1180
1181 Keyword arguments:
1182 tries -- number of tries
1183 timeout -- sleep interval between tries
1184
1185 See _download_webpage_handle docstring for other arguments specification.
1186 """
1187
1188 R''' # NB: These are unused; should they be deprecated?
1189 if tries != 1:
1190 self._downloader.deprecation_warning('tries argument is deprecated in InfoExtractor._download_webpage')
1191 if timeout is NO_DEFAULT:
1192 timeout = 5
1193 else:
1194 self._downloader.deprecation_warning('timeout argument is deprecated in InfoExtractor._download_webpage')
1195 '''
1196
1197 try_count = 0
1198 while True:
1199 try:
1200 return self.__download_webpage(url_or_request, video_id, note, errnote, None, fatal, *args, **kwargs)
1201 except IncompleteRead as e:
1202 try_count += 1
1203 if try_count >= tries:
1204 raise e
1205 self._sleep(timeout, video_id)
1206
1207 def report_warning(self, msg, video_id=None, *args, only_once=False, **kwargs):
1208 idstr = format_field(video_id, None, '%s: ')

Callers 15

_load_playerFunction · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80
_real_extractMethod · 0.80

Calls 1

_sleepMethod · 0.95

Tested by 1

_load_playerFunction · 0.64