Browse Source

[vshare] Capture and output error message

master-ytdl-org
Sergey M․ 7 years ago
parent
commit
ff31f2d5c3
No known key found for this signature in database GPG Key ID: 2C393E0F18A9236D
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      youtube_dl/extractor/vshare.py

+ 10
- 1
youtube_dl/extractor/vshare.py View File

@ -5,7 +5,10 @@ import re
from .common import InfoExtractor
from ..compat import compat_chr
from ..utils import decode_packed_codes
from ..utils import (
decode_packed_codes,
ExtractorError,
)
class VShareIE(InfoExtractor):
@ -42,6 +45,12 @@ class VShareIE(InfoExtractor):
title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, 'title')
title = title.split(' - ')[0]
error = self._html_search_regex(
r'(?s)<div[^>]+\bclass=["\']xxx-error[^>]+>(.+?)</div', webpage,
'error', default=None)
if error:
raise ExtractorError(error, expected=True)
unpacked = self._extract_packed(webpage)
video_urls = re.findall(r'<source src="([^"]+)', unpacked)
formats = [{'url': video_url} for video_url in video_urls]


Loading…
Cancel
Save