1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-24 17:06:58 +00:00

Fixed pyflakes and pep8 warnings

This commit is contained in:
Keith Beckman 2014-05-20 02:55:21 -04:00
parent dd06c95e43
commit 7ed806d241

View File

@ -11,6 +11,7 @@ from os.path import basename
from .common import InfoExtractor
from ..utils import ExtractorError, compat_urllib_request, compat_html_parser
class GroovesharkHtmlParser(compat_html_parser.HTMLParser):
def __init__(self):
self._current_object = None
@ -20,7 +21,7 @@ class GroovesharkHtmlParser(compat_html_parser.HTMLParser):
def handle_starttag(self, tag, attrs):
attrs = dict((k, v) for k, v in attrs)
if tag == 'object':
self._current_object = { 'attrs': attrs, 'params': [] }
self._current_object = {'attrs': attrs, 'params': []}
elif tag == 'param':
self._current_object['params'].append(attrs)
@ -36,6 +37,7 @@ class GroovesharkHtmlParser(compat_html_parser.HTMLParser):
p.close()
return p.objects
class GroovesharkIE(InfoExtractor):
_VALID_URL = r'https?://(www\.)?grooveshark\.com/#!/s/([^/]+)/([^/]+)'
_TEST = {
@ -154,12 +156,12 @@ class GroovesharkIE(InfoExtractor):
headers = {
'Content-Length': len(post_data),
'Content-Type': 'application/x-www-form-urlencoded'
}
}
if 'swf_referer' in locals():
headers['Referer'] = swf_referer
req = compat_urllib_request.Request(streamurl, post_data, headers)
req = compat_urllib_request.Request(stream_url, post_data, headers)
info_dict = {
'id': token,
@ -170,11 +172,13 @@ class GroovesharkIE(InfoExtractor):
'format': 'mp3 audio',
'duration': duration,
# various ways of supporting the download request.
# remove keys unnecessary to the eventual post implementation
'post_data': post_data,
'post_dict': post_dict,
'headers': headers,
'request': req
}
}
if 'swf_referer' in locals():
info_dict['http_referer'] = swf_referer
@ -197,4 +201,3 @@ class GroovesharkIE(InfoExtractor):
if fatal:
raise ee
return None