fix unexpected argument to BrokenPageError
This commit is contained in:
parent
440baee739
commit
1ffc83df5d
1 changed files with 7 additions and 8 deletions
|
|
@ -799,8 +799,7 @@ class VideoPage(BaseYoutubePage):
|
||||||
url_map = {}
|
url_map = {}
|
||||||
def _get_urls(_manifest):
|
def _get_urls(_manifest):
|
||||||
lines = _manifest.split('\n')
|
lines = _manifest.split('\n')
|
||||||
urls = filter(lambda l: l and not l.startswith('#'),
|
urls = filter(lambda l: l and not l.startswith('#'), lines)
|
||||||
lines)
|
|
||||||
return urls
|
return urls
|
||||||
manifest = self.browser.readurl(manifest_url)
|
manifest = self.browser.readurl(manifest_url)
|
||||||
formats_urls = _get_urls(manifest)
|
formats_urls = _get_urls(manifest)
|
||||||
|
|
@ -847,7 +846,7 @@ class VideoPage(BaseYoutubePage):
|
||||||
break
|
break
|
||||||
if 'token' not in video_info:
|
if 'token' not in video_info:
|
||||||
if 'reason' in video_info:
|
if 'reason' in video_info:
|
||||||
raise BrokenPageError(u'YouTube said: %s' % video_info['reason'][0], expected=True)
|
raise UserError(video_info['reason'][0])
|
||||||
else:
|
else:
|
||||||
raise BrokenPageError(u'"token" parameter not in video info for unknown reason')
|
raise BrokenPageError(u'"token" parameter not in video info for unknown reason')
|
||||||
|
|
||||||
|
|
@ -893,7 +892,6 @@ class VideoPage(BaseYoutubePage):
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
|
||||||
self.report_rtmp_download()
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'format_id': '_rtmp',
|
'format_id': '_rtmp',
|
||||||
'protocol': 'rtmp',
|
'protocol': 'rtmp',
|
||||||
|
|
@ -987,7 +985,7 @@ class VideoPage(BaseYoutubePage):
|
||||||
)
|
)
|
||||||
formats.sort(key=_formats_key)
|
formats.sort(key=_formats_key)
|
||||||
|
|
||||||
def _search_regex(self, pattern, string, name, default=_NO_DEFAULT, fatal=True, flags=0):
|
def _search_regex(self, pattern, text, name, default=_NO_DEFAULT, fatal=True, flags=0):
|
||||||
"""
|
"""
|
||||||
Perform a regex search on the given string, using a single or a list of
|
Perform a regex search on the given string, using a single or a list of
|
||||||
patterns returning the first matching group.
|
patterns returning the first matching group.
|
||||||
|
|
@ -995,11 +993,12 @@ class VideoPage(BaseYoutubePage):
|
||||||
RegexNotFoundError, depending on fatal, specifying the field name.
|
RegexNotFoundError, depending on fatal, specifying the field name.
|
||||||
"""
|
"""
|
||||||
if isinstance(pattern, (str, unicode, type(re.compile('')))):
|
if isinstance(pattern, (str, unicode, type(re.compile('')))):
|
||||||
mobj = re.search(pattern, string, flags)
|
mobj = re.search(pattern, text, flags)
|
||||||
else:
|
else:
|
||||||
for p in pattern:
|
for p in pattern:
|
||||||
mobj = re.search(p, string, flags)
|
mobj = re.search(p, text, flags)
|
||||||
if mobj: break
|
if mobj:
|
||||||
|
break
|
||||||
|
|
||||||
if mobj:
|
if mobj:
|
||||||
# return the first matching group
|
# return the first matching group
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue