From c56102dd16899f4a169e2ab47c896aa22438bcc0 Mon Sep 17 00:00:00 2001 From: "M.Yasoob Khalid" Date: Thu, 6 Jun 2013 12:28:18 +0500 Subject: [PATCH] rephrased my code a little. --- youtube_dl/InfoExtractors.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 211ef0ba9..1936ee241 100755 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -4494,19 +4494,14 @@ class HypemIE(InfoExtractor): data = {'ax':1 , 'ts': time.time() } + id = mobj.group(1) data_encoded = compat_urllib_parse.urlencode(data) complete_url = url + "?"+data_encoded request = compat_urllib_request.Request(complete_url) - response = compat_urllib_request.urlopen(request) - #save our cookie - cookie = response.headers.get('Set-Cookie') - encoding = response.headers.get('Content-Type') - encoding = (encoding.split(';')[1]).split('=')[1] - #grab the HTML - html = response.read().decode(encoding) - response.close() + response,urlh = self._download_webpage_handle(request, id, u'Downloading webpage with the url') + cookie = urlh.headers.get('Set-Cookie', '') track_list = [] - list_data = re.search(r'',html) + list_data = re.search(r'',response) html_tracks = list_data.group(1) if html_tracks is None: tracks = track_list