mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 22:51:45 +00:00
[ie/swearnet] Raise for login required (#9281)
Closes #9110 Authored by: bashonly
This commit is contained in:
parent
7a29cbbd5f
commit
b05640d532
@ -1,5 +1,5 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import int_or_none, traverse_obj
|
from ..utils import ExtractorError, int_or_none, traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class SwearnetEpisodeIE(InfoExtractor):
|
class SwearnetEpisodeIE(InfoExtractor):
|
||||||
@ -51,7 +51,13 @@ class SwearnetEpisodeIE(InfoExtractor):
|
|||||||
display_id, season_number, episode_number = self._match_valid_url(url).group('id', 'season_num', 'episode_num')
|
display_id, season_number, episode_number = self._match_valid_url(url).group('id', 'season_num', 'episode_num')
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
try:
|
||||||
external_id = self._search_regex(r'externalid\s*=\s*"([^"]+)', webpage, 'externalid')
|
external_id = self._search_regex(r'externalid\s*=\s*"([^"]+)', webpage, 'externalid')
|
||||||
|
except ExtractorError:
|
||||||
|
if 'Upgrade Now' in webpage:
|
||||||
|
self.raise_login_required()
|
||||||
|
raise
|
||||||
|
|
||||||
json_data = self._download_json(
|
json_data = self._download_json(
|
||||||
f'https://play.vidyard.com/player/{external_id}.json', display_id)['payload']['chapters'][0]
|
f'https://play.vidyard.com/player/{external_id}.json', display_id)['payload']['chapters'][0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user