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 = {
@ -159,7 +161,7 @@ class GroovesharkIE(InfoExtractor):
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,6 +172,8 @@ 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,
@ -197,4 +201,3 @@ class GroovesharkIE(InfoExtractor):
if fatal:
raise ee
return None