diff options
author | Lesmiscore <nao20010128@gmail.com> | 2023-03-27 22:39:55 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 22:39:55 +0900 |
commit | 95a383be1b6fb00c92ee3fb091732c4f6009acb6 (patch) | |
tree | 4d1e5a80a8c75ea0b4110bf66bb06ccaae4e5616 /yt_dlp | |
parent | 9be0fe1fd967f62cbf3c60bd14e1021a70abc147 (diff) | |
download | hypervideo-pre-95a383be1b6fb00c92ee3fb091732c4f6009acb6.tar.lz hypervideo-pre-95a383be1b6fb00c92ee3fb091732c4f6009acb6.tar.xz hypervideo-pre-95a383be1b6fb00c92ee3fb091732c4f6009acb6.zip |
[extractor/iwara] Report private videos (#6641)
Authored by: Lesmiscore
Diffstat (limited to 'yt_dlp')
-rw-r--r-- | yt_dlp/extractor/iwara.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/yt_dlp/extractor/iwara.py b/yt_dlp/extractor/iwara.py index 62a179700..23f92786f 100644 --- a/yt_dlp/extractor/iwara.py +++ b/yt_dlp/extractor/iwara.py @@ -4,6 +4,7 @@ import hashlib from .common import InfoExtractor from ..utils import ( + ExtractorError, OnDemandPagedList, int_or_none, mimetype2ext, @@ -75,7 +76,13 @@ class IwaraIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video_data = self._download_json(f'http://api.iwara.tv/video/{video_id}', video_id) + video_data = self._download_json(f'http://api.iwara.tv/video/{video_id}', video_id, expected_status=lambda x: True) + errmsg = video_data.get('message') + # at this point we can actually get uploaded user info, but do we need it? + if errmsg == 'errors.privateVideo': + self.raise_login_required('Private video. Login if you have permissions to watch') + elif errmsg: + raise ExtractorError(f'Iwara says: {errmsg}') return { 'id': video_id, |