Skip to content

Commit

Permalink
Fix parse_qs importing for Python < 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Sep 18, 2012
1 parent 61f2cfa commit 0d60596
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gpodder/youtube.py
Expand Up @@ -35,7 +35,13 @@

import re
import urllib
import urlparse

try:
# Python >= 2.6
from urlparse import parse_qs
except ImportError:
# Python < 2.6
from cgi import parse_qs

# See http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
# Currently missing: 3GP profile
Expand Down Expand Up @@ -82,7 +88,7 @@ def find_urls(page):
if r4 is not None:
fmt_url_map = urllib.unquote(r4.group(1))
for fmt_url_encoded in fmt_url_map.split(','):
video_info = urlparse.parse_qs(fmt_url_encoded)
video_info = parse_qs(fmt_url_encoded)
yield int(video_info['itag'][0]), video_info['url'][0]

fmt_id_url_map = sorted(find_urls(page), reverse=True)
Expand Down

0 comments on commit 0d60596

Please sign in to comment.