mirror of https://github.com/yt-dlp/yt-dlp.git
[ie/adn] Improve auth error handling (#9068)
Closes #9067 Authored by: infanf
This commit is contained in:
parent
0023af81fb
commit
9526b1f179
|
@ -3,6 +3,7 @@ import binascii
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7
|
from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7
|
||||||
|
@ -17,6 +18,7 @@ from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
intlist_to_bytes,
|
intlist_to_bytes,
|
||||||
long_to_bytes,
|
long_to_bytes,
|
||||||
|
parse_iso8601,
|
||||||
pkcs1pad,
|
pkcs1pad,
|
||||||
strip_or_none,
|
strip_or_none,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
|
@ -185,7 +187,10 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
||||||
|
|
||||||
user = options['user']
|
user = options['user']
|
||||||
if not user.get('hasAccess'):
|
if not user.get('hasAccess'):
|
||||||
self.raise_login_required()
|
start_date = traverse_obj(options, ('video', 'startDate', {str}))
|
||||||
|
if (parse_iso8601(start_date) or 0) > time.time():
|
||||||
|
raise ExtractorError(f'This video is not available yet. Release date: {start_date}', expected=True)
|
||||||
|
self.raise_login_required('This video requires a subscription', method='password')
|
||||||
|
|
||||||
token = self._download_json(
|
token = self._download_json(
|
||||||
user.get('refreshTokenUrl') or (self._PLAYER_BASE_URL + 'refresh/token'),
|
user.get('refreshTokenUrl') or (self._PLAYER_BASE_URL + 'refresh/token'),
|
||||||
|
@ -267,6 +272,9 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
||||||
f['language'] = 'de'
|
f['language'] = 'de'
|
||||||
formats.extend(m3u8_formats)
|
formats.extend(m3u8_formats)
|
||||||
|
|
||||||
|
if not formats:
|
||||||
|
self.raise_login_required('This video requires a subscription', method='password')
|
||||||
|
|
||||||
video = (self._download_json(
|
video = (self._download_json(
|
||||||
self._API_BASE_URL + 'video/%s' % video_id, video_id,
|
self._API_BASE_URL + 'video/%s' % video_id, video_id,
|
||||||
'Downloading additional video metadata', fatal=False) or {}).get('video') or {}
|
'Downloading additional video metadata', fatal=False) or {}).get('video') or {}
|
||||||
|
|
Loading…
Reference in New Issue