detect if video is forbidden and raise an appropriated exception
This commit is contained in:
parent
ff5de14bf3
commit
7f81f261a1
1 changed files with 5 additions and 0 deletions
|
|
@ -125,4 +125,9 @@ class VideoPage(BaseYoutubePage):
|
|||
ext = self.FORMAT_EXTENSIONS.get(format, 'flv')
|
||||
return url, ext
|
||||
|
||||
# check errors only here, in case the video url is available though
|
||||
error = self.document.xpath('//h1[@id="unavailable-message"]')
|
||||
if len(error) > 0:
|
||||
raise ForbiddenVideo(unicode(error[0].text).strip())
|
||||
|
||||
raise BrokenPageError('Unable to find file URL')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue