mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-28 14:34:41 +00:00
[drtv] Convert to new subtitles system
This commit is contained in:
parent
37dd5d4629
commit
18c1c42405
@ -1,11 +1,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .subtitles import SubtitlesInfoExtractor
|
from .common import InfoExtractor, ExtractorError
|
||||||
from .common import ExtractorError
|
|
||||||
from ..utils import parse_iso8601
|
from ..utils import parse_iso8601
|
||||||
|
|
||||||
|
|
||||||
class DRTVIE(SubtitlesInfoExtractor):
|
class DRTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?dr\.dk/tv/se/(?:[^/]+/)*(?P<id>[\da-z-]+)(?:[/#?]|$)'
|
_VALID_URL = r'https?://(?:www\.)?dr\.dk/tv/se/(?:[^/]+/)*(?P<id>[\da-z-]+)(?:[/#?]|$)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
@ -76,7 +75,7 @@ class DRTVIE(SubtitlesInfoExtractor):
|
|||||||
}
|
}
|
||||||
for subs in subtitles_list:
|
for subs in subtitles_list:
|
||||||
lang = subs['Language']
|
lang = subs['Language']
|
||||||
subtitles[LANGS.get(lang, lang)] = subs['Uri']
|
subtitles[LANGS.get(lang, lang)] = [{'url': subs['Uri'], 'ext': 'vtt'}]
|
||||||
|
|
||||||
if not formats and restricted_to_denmark:
|
if not formats and restricted_to_denmark:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
@ -84,10 +83,6 @@ class DRTVIE(SubtitlesInfoExtractor):
|
|||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
if self._downloader.params.get('listsubtitles', False):
|
|
||||||
self._list_available_subtitles(video_id, subtitles)
|
|
||||||
return
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
@ -96,5 +91,5 @@ class DRTVIE(SubtitlesInfoExtractor):
|
|||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': self.extract_subtitles(video_id, subtitles),
|
'subtitles': subtitles,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user