Repository: yt-dlp/yt-dlp

Issue:
Iwara.tv: Inform if Private videos
### Checklist

- [X] I'm reporting a site feature request
- [X] I've verified that I'm running yt-dlp version **2022.05.18** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

_No response_

### Example URLs

https://ecchi.iwara.tv/videos/e8qgbhwwxhmxyq39

### Description

Instead of an error message, inform user if its a private video and cant be downloaded.

### Verbose log

```shell
F:\downloader\iwara.tv\dl>yt-dlp https://ecchi.iwara.tv/videos/e8qgbhwwxhmxyq39 --conf config_iwara --verbose
[debug] Command-line config: ['https://ecchi.iwara.tv/videos/e8qgbhwwxhmxyq39', '--conf', 'config_iwara', '--verbose']
[debug] | Config "config_iwara": ['--continue', '--http-chunk-size', '1M', '--buffer-size', '16K', '--sub-lang', 'english', '--embed-metadata', '--embed-thumbnail', '--abort-on-unavailable-fragment', '-o', '%(age_limit)s\\%(uploader)s\\%(title)s [%(id)s].%(ext)s', '--download-archive', 'downloaded.txt', '-f', 'Source/540p/360p', '--ffmpeg-location', 'D:\\Program Files\\ffmpeg\\bin']
[debug] User config "C:\Users\X\AppData\Roaming\yt-dlp\config": ['--continue', '--format-sort', 'vbr,abr', '--http-chunk-size', '1M', '--buffer-size', '16K', '--sub-lang', 'english', '--embed-metadata', '--abort-on-unavailable-fragment', '-o', '%(title)s [%(id)s].%(ext)s', '--ffmpeg-location', 'D:\\Program Files\\ffmpeg\\bin']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.05.18 [b14d52355]
[debug] Lazy loading extractors is disabled
[debug] Python version 3.10.4 (CPython 64bit) - Windows-10-10.0.19043-SP0
[debug] Checking exe version: "D:\Program Files\ffmpeg\bin\ffmpeg" -bsfs
[debug] Checking exe version: "D:\Program Files\ffmpeg\bin\ffprobe" -bsfs
[debug] exe versions: ffmpeg 2022-03-28-git-5ee198f9aa-essentials_build-www.gyan.dev (setts), ffprobe 2022-03-28-git-5ee198f9aa-essentials_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2021.10.08, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.2
[debug] Proxy map: {}
[debug] Loading archive file 'downloaded.txt'
[debug] [Iwara] Extracting URL: https://ecchi.iwara.tv/videos/e8qgbhwwxhmxyq39
[Iwara] e8qgbhwwxhmxyq39: Downloading webpage
[Iwara] e8qgbhwwxhmxyq39: Downloading JSON metadata
ERROR: [Iwara] e8qgbhwwxhmxyq39: Unable to extract iframe URL; please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "C:\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 642, in extract
    ie_result = self._real_extract(url)
  File "C:\Python\Python310\lib\site-packages\yt_dlp\extractor\iwara.py", line 77, in _real_extract
    iframe_url = self._html_search_regex(
  File "C:\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 1235, in _html_search_regex
    res = self._search_regex(pattern, string, name, default, fatal, flags, group)
  File "C:\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 1226, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)


F:\downloader\iwara.tv\dl>pause
Press any key to continue . . .
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/iwara.py b/yt_dlp/extractor/iwara.py
--- a/yt_dlp/extractor/iwara.py
+++ b/yt_dlp/extractor/iwara.py
@@ -4,6 +4,7 @@
 
 from .common import InfoExtractor
 from ..utils import (
+    ExtractorError,
     OnDemandPagedList,
     int_or_none,
     mimetype2ext,
@@ -75,7 +76,13 @@ def _extract_formats(self, video_id, fileurl):
 
     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,


Test patch: