Style fixes for extractors: remove spaces around (,),{ and }

This commit is contained in:
Jaime Marquínez Ferrándiz 2013-11-03 14:03:17 +01:00
parent fa5d47af4b
commit a56f9de156
13 changed files with 33 additions and 33 deletions

View File

@ -25,7 +25,7 @@ def _real_extract(self, url):
url = 'http://depositfiles.com/en/files/' + file_id url = 'http://depositfiles.com/en/files/' + file_id
# Retrieve file webpage with 'Free download' button pressed # Retrieve file webpage with 'Free download' button pressed
free_download_indication = { 'gateway_result' : '1' } free_download_indication = {'gateway_result' : '1'}
request = compat_urllib_request.Request(url, compat_urllib_parse.urlencode(free_download_indication)) request = compat_urllib_request.Request(url, compat_urllib_parse.urlencode(free_download_indication))
try: try:
self.report_download_webpage(file_id) self.report_download_webpage(file_id)

View File

@ -33,10 +33,10 @@ def _real_extract(self, url):
video_title = self._html_search_regex(r'<h1 [^>]*?title="([^"]+)"[^>]*>\1<', webpage, u'title') video_title = self._html_search_regex(r'<h1 [^>]*?title="([^"]+)"[^>]*>\1<', webpage, u'title')
uploader = self._html_search_regex(r'>Posted by:(?=<)(?:\s|<[^>]*>)*(.+?)\|', webpage, u'uploader', fatal=False) uploader = self._html_search_regex(r'>Posted by:(?=<)(?:\s|<[^>]*>)*(.+?)\|', webpage, u'uploader', fatal=False)
video_url = compat_urllib_parse.unquote(self._html_search_regex(r'video_url=(.+?)&amp;', webpage, u'video_url')) video_url = compat_urllib_parse.unquote(self._html_search_regex(r'video_url=(.+?)&amp;', webpage, u'video_url'))
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[5].split('_')[:2] format = path.split('/')[5].split('_')[:2]
format = "-".join( format ) format = "-".join(format)
return { return {
'id': video_id, 'id': video_id,

View File

@ -30,7 +30,7 @@ def _real_extract(self, url):
raise ExtractorError(u'Invalid URL: %s' % url) raise ExtractorError(u'Invalid URL: %s' % url)
track_id = mobj.group(1) track_id = mobj.group(1)
data = { 'ax': 1, 'ts': time.time() } data = {'ax': 1, 'ts': time.time()}
data_encoded = compat_urllib_parse.urlencode(data) data_encoded = compat_urllib_parse.urlencode(data)
complete_url = url + "?" + data_encoded complete_url = url + "?" + data_encoded
request = compat_urllib_request.Request(complete_url) request = compat_urllib_request.Request(complete_url)
@ -68,4 +68,4 @@ def _real_extract(self, url):
'ext': "mp3", 'ext': "mp3",
'title': title, 'title': title,
'artist': artist, 'artist': artist,
}] }]

View File

@ -43,10 +43,10 @@ def _real_extract(self, url):
if webpage.find('encrypted=true')!=-1: if webpage.find('encrypted=true')!=-1:
password = self._html_search_regex(r'video_title=(.+?)&amp;', webpage, u'password') password = self._html_search_regex(r'video_title=(.+?)&amp;', webpage, u'password')
video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8') video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8')
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[4].split('_')[:2] format = path.split('/')[4].split('_')[:2]
format = "-".join( format ) format = "-".join(format)
age_limit = self._rta_search(webpage) age_limit = self._rta_search(webpage)

View File

@ -31,10 +31,10 @@ def _real_extract(self, url):
video_title = self._html_search_regex(r'<h1>(.+?)<', webpage, u'title') video_title = self._html_search_regex(r'<h1>(.+?)<', webpage, u'title')
video_url = compat_urllib_parse.unquote(self._html_search_regex(r'flashvars.video_url = \'([^\']+)', webpage, u'video_url')) video_url = compat_urllib_parse.unquote(self._html_search_regex(r'flashvars.video_url = \'([^\']+)', webpage, u'video_url'))
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[5].split('_')[:2] format = path.split('/')[5].split('_')[:2]
format = "-".join( format ) format = "-".join(format)
age_limit = self._rta_search(webpage) age_limit = self._rta_search(webpage)

View File

@ -47,10 +47,10 @@ def _real_extract(self, url):
formats = [] formats = []
for video_url in video_urls: for video_url in video_urls:
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[5].split('_')[:2] format = path.split('/')[5].split('_')[:2]
format = "-".join( format ) format = "-".join(format)
formats.append({ formats.append({
'url': video_url, 'url': video_url,
'ext': extension, 'ext': extension,

View File

@ -49,10 +49,10 @@ def _real_extract(self, url):
formats = [] formats = []
for video_url in video_urls: for video_url in video_urls:
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[4].split('_')[:2] format = path.split('/')[4].split('_')[:2]
format = "-".join( format ) format = "-".join(format)
formats.append({ formats.append({
'url': video_url, 'url': video_url,
'ext': extension, 'ext': extension,

View File

@ -46,10 +46,10 @@ def _real_extract(self, url):
if webpage.find('"encrypted":true')!=-1: if webpage.find('"encrypted":true')!=-1:
password = self._html_search_regex(r'"video_title":"([^"]+)', webpage, u'password') password = self._html_search_regex(r'"video_title":"([^"]+)', webpage, u'password')
video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8') video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8')
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[4].split('_')[:2] format = path.split('/')[4].split('_')[:2]
format = "-".join( format ) format = "-".join(format)
return { return {
'id': video_id, 'id': video_id,

View File

@ -203,7 +203,7 @@ def _real_extract(self, url, new_video=True):
# Vimeo specific: extract video codec and quality information # Vimeo specific: extract video codec and quality information
# First consider quality, then codecs, then take everything # First consider quality, then codecs, then take everything
codecs = [('vp6', 'flv'), ('vp8', 'flv'), ('h264', 'mp4')] codecs = [('vp6', 'flv'), ('vp8', 'flv'), ('h264', 'mp4')]
files = { 'hd': [], 'sd': [], 'other': []} files = {'hd': [], 'sd': [], 'other': []}
config_files = config["video"].get("files") or config["request"].get("files") config_files = config["video"].get("files") or config["request"].get("files")
for codec_name, codec_extension in codecs: for codec_name, codec_extension in codecs:
for quality in config_files.get(codec_name, []): for quality in config_files.get(codec_name, []):

View File

@ -35,12 +35,12 @@ def _real_extract(self, url):
video_uploader = self._html_search_regex(r'so_s\.addVariable\("owner_u", "([^"]+)', webpage, u'uploader', fatal=False) video_uploader = self._html_search_regex(r'so_s\.addVariable\("owner_u", "([^"]+)', webpage, u'uploader', fatal=False)
video_description = self._html_search_regex(r'<p class="video_description">([^<]+)', webpage, u'description', default=None) video_description = self._html_search_regex(r'<p class="video_description">([^<]+)', webpage, u'description', default=None)
video_url= self._html_search_regex(r'var videoMp4 = "([^"]+)', webpage, u'video_url').replace('\\/', '/') video_url= self._html_search_regex(r'var videoMp4 = "([^"]+)', webpage, u'video_url').replace('\\/', '/')
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[5].split('_')[:2] format = path.split('/')[5].split('_')[:2]
format[0] += 'p' format[0] += 'p'
format[1] += 'k' format[1] += 'k'
format = "-".join( format ) format = "-".join(format)
return { return {
'id': video_id, 'id': video_id,

View File

@ -132,7 +132,7 @@ def _get_n_results(self, query, n):
mobj = re.search(r'(?P<url>screen\.yahoo\.com/.*?-\d*?\.html)"', r) mobj = re.search(r'(?P<url>screen\.yahoo\.com/.*?-\d*?\.html)"', r)
e = self.url_result('http://' + mobj.group('url'), 'Yahoo') e = self.url_result('http://' + mobj.group('url'), 'Yahoo')
res['entries'].append(e) res['entries'].append(e)
if (pagenum * 30 +i >= n) or (m[u'last'] >= (m[u'total'] -1 )): if (pagenum * 30 +i >= n) or (m[u'last'] >= (m[u'total'] -1)):
break break
return res return res

View File

@ -18,7 +18,7 @@ class YoukuIE(InfoExtractor):
u"url": u"http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html", u"url": u"http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html",
u"file": u"XNDgyMDQ2NTQw_part00.flv", u"file": u"XNDgyMDQ2NTQw_part00.flv",
u"md5": u"ffe3f2e435663dc2d1eea34faeff5b5b", u"md5": u"ffe3f2e435663dc2d1eea34faeff5b5b",
u"params": { u"test": False }, u"params": {u"test": False},
u"info_dict": { u"info_dict": {
u"title": u"youtube-dl test video \"'/\\ä↭𝕐" u"title": u"youtube-dl test video \"'/\\ä↭𝕐"
} }
@ -37,8 +37,8 @@ def _get_file_ID_mix_string(self, seed):
source = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\:._-1234567890") source = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\:._-1234567890")
seed = float(seed) seed = float(seed)
for i in range(len(source)): for i in range(len(source)):
seed = (seed * 211 + 30031 ) % 65536 seed = (seed * 211 + 30031) % 65536
index = math.floor(seed / 65536 * len(source) ) index = math.floor(seed / 65536 * len(source))
mixed.append(source[int(index)]) mixed.append(source[int(index)])
source.remove(source[int(index)]) source.remove(source[int(index)])
#return ''.join(mixed) #return ''.join(mixed)

View File

@ -81,14 +81,14 @@ def _real_extract(self, url):
# http://cdn1.download.youporn.phncdn.com/201210/31/8004515/480p_370k_8004515/YouPorn%20-%20Nubile%20Films%20The%20Pillow%20Fight.mp4?nvb=20121113051249&nva=20121114051249&ir=1200&sr=1200&hash=014b882080310e95fb6a0 # http://cdn1.download.youporn.phncdn.com/201210/31/8004515/480p_370k_8004515/YouPorn%20-%20Nubile%20Films%20The%20Pillow%20Fight.mp4?nvb=20121113051249&nva=20121114051249&ir=1200&sr=1200&hash=014b882080310e95fb6a0
# A path looks like this: # A path looks like this:
# /201210/31/8004515/480p_370k_8004515/YouPorn%20-%20Nubile%20Films%20The%20Pillow%20Fight.mp4 # /201210/31/8004515/480p_370k_8004515/YouPorn%20-%20Nubile%20Films%20The%20Pillow%20Fight.mp4
video_url = unescapeHTML( link ) video_url = unescapeHTML(link)
path = compat_urllib_parse_urlparse( video_url ).path path = compat_urllib_parse_urlparse(video_url).path
extension = os.path.splitext( path )[1][1:] extension = os.path.splitext(path)[1][1:]
format = path.split('/')[4].split('_')[:2] format = path.split('/')[4].split('_')[:2]
# size = format[0] # size = format[0]
# bitrate = format[1] # bitrate = format[1]
format = "-".join( format ) format = "-".join(format)
# title = u'%s-%s-%s' % (video_title, size, bitrate) # title = u'%s-%s-%s' % (video_title, size, bitrate)
formats.append({ formats.append({