Created
May 6, 2020 14:12
-
-
Save wader/8c4a6d72ef3359ecb039230df5708f28 to your computer and use it in GitHub Desktop.
svtplay timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/youtube_dl/extractor/svt.py b/youtube_dl/extractor/svt.py | |
| index e12389cad..388a06448 100644 | |
| --- a/youtube_dl/extractor/svt.py | |
| +++ b/youtube_dl/extractor/svt.py | |
| @@ -12,6 +12,7 @@ from ..utils import ( | |
| str_or_none, | |
| strip_or_none, | |
| try_get, | |
| + parse_iso8601, | |
| ) | |
| @@ -44,7 +45,8 @@ class SVTBaseIE(InfoExtractor): | |
| 'format_id': player_type, | |
| 'url': vurl, | |
| }) | |
| - if not formats and video_info.get('rights', {}).get('geoBlockedSweden'): | |
| + rights = video_info.get('rights', {}) | |
| + if not formats and rights.get('geoBlockedSweden'): | |
| self.raise_geo_restricted( | |
| 'This video is only available in Sweden', | |
| countries=self._GEO_COUNTRIES) | |
| @@ -64,7 +66,7 @@ class SVTBaseIE(InfoExtractor): | |
| subtitles.setdefault(subtitle_lang, []).append({'url': subtitle_url}) | |
| title = video_info.get('title') | |
| - | |
| + timestamp = parse_iso8601(rights.get('validFrom')) | |
| series = video_info.get('programTitle') | |
| season_number = int_or_none(video_info.get('season')) | |
| episode = video_info.get('episodeTitle') | |
| @@ -81,6 +83,7 @@ class SVTBaseIE(InfoExtractor): | |
| return { | |
| 'id': video_id, | |
| 'title': title, | |
| + 'timestamp': timestamp, | |
| 'formats': formats, | |
| 'subtitles': subtitles, | |
| 'duration': duration, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment