mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
parent
d51e23d9fc
commit
37fb591c0b
1 changed files with 10 additions and 2 deletions
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
GeoRestrictedError,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
@ -59,8 +61,14 @@ def _real_extract(self, url):
|
||||||
for format_url in orderedSet(format_urls)]
|
for format_url in orderedSet(format_urls)]
|
||||||
|
|
||||||
if not formats:
|
if not formats:
|
||||||
formats = self._parse_html5_media_entries(
|
entries = self._parse_html5_media_entries(
|
||||||
url, webpage, video_id)[0]['formats']
|
url, webpage, video_id)
|
||||||
|
if not entries:
|
||||||
|
error = self._html_search_regex(r'<h1 class="page-title">([^<]+)</h1>', webpage, 'error', default='Cannot find video')
|
||||||
|
if error == 'Video Unavailable':
|
||||||
|
raise GeoRestrictedError(error)
|
||||||
|
raise ExtractorError(error)
|
||||||
|
formats = entries[0]['formats']
|
||||||
|
|
||||||
self._check_formats(formats, video_id)
|
self._check_formats(formats, video_id)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
Loading…
Reference in a new issue