]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Add flexibility importing the "parse_qs" function (fixes issue #81)
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>
Wed, 6 Jan 2010 09:49:38 +0000 (10:49 +0100)
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 31 Oct 2010 10:25:05 +0000 (11:25 +0100)
youtube-dl

index 07ef5dcfc92402fb3b148f47a204eb7d205b3c2c..bdc33b57f2eb0992c22641797edf255987ee1a9b 100755 (executable)
@@ -18,7 +18,12 @@ import sys
 import time
 import urllib
 import urllib2
-import urlparse
+
+# parse_qs was moved from the cgi module to the urlparse module recently.
+try:
+       from urlparse import parse_qs
+except ImportError:
+       from cgi import parse_qs
 
 std_headers = {
        'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2',
@@ -729,7 +734,7 @@ class YoutubeIE(InfoExtractor):
                        try:
                                self.report_video_info_webpage_download(video_id)
                                video_info_webpage = urllib2.urlopen(request).read()
-                               video_info = urlparse.parse_qs(video_info_webpage)
+                               video_info = parse_qs(video_info_webpage)
                        except (urllib2.URLError, httplib.HTTPException, socket.error), err:
                                self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % str(err))
                                return