1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-21 16:45:41 +07:00

Move the opener to the YoutubeDL object.

This is the first step towards being able to just import youtube_dl and start using it.
Apart from removing global state, this would fix problems like #1805.
This commit is contained in:
Philipp Hagemeister
2013-11-22 19:57:52 +01:00
parent 0b63aed8df
commit dca0872056
4 changed files with 96 additions and 96 deletions

View File

@@ -8,7 +8,6 @@
from ..utils import (
compat_http_client,
compat_urllib_error,
compat_urllib_request,
compat_str,
clean_html,
@@ -19,6 +18,7 @@
unescapeHTML,
)
class InfoExtractor(object):
"""Information Extractor class.
@@ -156,7 +156,7 @@ def _request_webpage(self, url_or_request, video_id, note=None, errnote=None):
elif note is not False:
self.to_screen(u'%s: %s' % (video_id, note))
try:
return compat_urllib_request.urlopen(url_or_request)
return self._downloader.urlopen(url_or_request)
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
if errnote is None:
errnote = u'Unable to download webpage'