1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

Close socket after downloading page.

On windows, when I make many requests it gives me error: **Python urllib2. URLError: <urlopen error [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted>**
according to: https://stackoverflow.com/questions/4526933/python-urllib2-urlerror-urlopen-error-errno-10048-only-one-usage-of-each-so
This commit is contained in:
bato3 2018-07-31 13:04:58 +02:00
parent 19b9de13c4
commit f6f513fbea

View File

@ -769,6 +769,7 @@ class InfoExtractor(object):
return res
else:
content, _ = res
_.close()
return content
def _download_xml_handle(
@ -807,7 +808,12 @@ class InfoExtractor(object):
transform_source=transform_source, fatal=fatal, encoding=encoding,
data=data, headers=headers, query=query,
expected_status=expected_status)
return res if res is False else res[0]
if res is False:
return res
else:
content, _ = res
_.close()
return content
def _parse_xml(self, xml_string, video_id, transform_source=None, fatal=True):
if transform_source:
@ -857,7 +863,12 @@ class InfoExtractor(object):
transform_source=transform_source, fatal=fatal, encoding=encoding,
data=data, headers=headers, query=query,
expected_status=expected_status)
return res if res is False else res[0]
if res is False:
return res
else:
content, _ = res
_.close()
return content
def _parse_json(self, json_string, video_id, transform_source=None, fatal=True):
if transform_source: