Repository: yt-dlp/yt-dlp

Issue:
[openrec] cannot download vod
### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.03.08.1**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/ytdl-org/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [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

Global

### Description

I tried to download this VOD:

https://www.openrec.tv/live/pnzg3jv15ry

It failed with `No video formats found!`.

The site requires login (free account is enough, no need for premium one for this VOD), so I tried with browser cookie, still failed.

Tried both latest release and `master`.

### Verbose log

```shell
G:\_temp\yt-dlp>yt-dlp.cmd "https://www.openrec.tv/live/pnzg3jv15ry" --cookies-from-browser chrome --verbose
[debug] Command-line config: ['https://www.openrec.tv/live/pnzg3jv15ry', '--cookies-from-browser', 'chrome', '--verbose']
[Cookies] Extracting cookies from chrome
[debug] Extracting cookies from: "C:\Users\***\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies"
[Cookies] Extracted 6850 cookies from chrome
[debug] cookie version breakdown: {'v10': 6849, 'other': 0, 'unencrypted': 1}
[debug] Encodings: locale cp936, fs utf-8, out utf-8 (No ANSI), err utf-8 (No ANSI), pref cp936
[debug] yt-dlp version 2022.03.08.1 [c0c2c57d3] (source)
[debug] Lazy loading extractors is disabled
[debug] Plugins: ['SamplePluginIE', 'SamplePluginPP']
[debug] Git HEAD: bb5a7cb8a
[debug] Python version 3.8.7 (CPython 64bit) - Windows-7-6.1.7601-SP1
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 2022-01-17-git-dcc9454ab9-full_build-www.gyan.dev (setts), ffprobe 2022-01-17-git-dcc9454ab9-full_build-www.gyan.dev, rtmpdump 2.3
[debug] Optional libraries: certifi, Cryptodome, secretstorage, mutagen, sqlite, websockets
[debug] Proxy map: {}
[debug] [openrec] Extracting URL: https://www.openrec.tv/live/pnzg3jv15ry
[openrec] pnzg3jv15ry: Downloading webpage
ERROR: [openrec] pnzg3jv15ry: No video formats found!; please report this issue on  https://github.com/yt-dlp/yt-dlp , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
Traceback (most recent call last):
  File "G:\_temp\yt-dlp\yt_dlp\YoutubeDL.py", line 1403, in wrapper
    return func(self, *args, **kwargs)
  File "G:\_temp\yt-dlp\yt_dlp\YoutubeDL.py", line 1487, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "G:\_temp\yt-dlp\yt_dlp\YoutubeDL.py", line 1543, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "G:\_temp\yt-dlp\yt_dlp\YoutubeDL.py", line 2475, in process_video_result
    self.raise_no_formats(info_dict)
  File "G:\_temp\yt-dlp\yt_dlp\YoutubeDL.py", line 981, in raise_no_formats
    raise ExtractorError(msg, video_id=info['id'], ie=info['extractor'],
yt_dlp.utils.ExtractorError: [openrec] pnzg3jv15ry: No video formats found!; please report this issue on  https://github.com/yt-dlp/yt-dlp , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
```



Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/openrec.py b/yt_dlp/extractor/openrec.py
--- a/yt_dlp/extractor/openrec.py
+++ b/yt_dlp/extractor/openrec.py
@@ -7,6 +7,7 @@
     get_first,
     int_or_none,
     traverse_obj,
+    try_get,
     unified_strdate,
     unified_timestamp,
 )
@@ -18,6 +19,13 @@ def _extract_pagestore(self, webpage, video_id):
         return self._parse_json(
             self._search_regex(r'(?m)window\.pageStore\s*=\s*(\{.+?\});$', webpage, 'window.pageStore'), video_id)
 
+    def _expand_media(self, video_id, media):
+        for name, m3u8_url in (media or {}).items():
+            if not m3u8_url:
+                continue
+            yield from self._extract_m3u8_formats(
+                m3u8_url, video_id, ext='mp4', m3u8_id=name)
+
     def _extract_movie(self, webpage, video_id, name, is_live):
         window_stores = self._extract_pagestore(webpage, video_id)
         movie_stores = [
@@ -29,13 +37,21 @@ def _extract_movie(self, webpage, video_id, name, is_live):
         if not any(movie_stores):
             raise ExtractorError(f'Failed to extract {name} info')
 
-        m3u8_playlists = get_first(movie_stores, 'media') or {}
-        formats = []
-        for name, m3u8_url in m3u8_playlists.items():
-            if not m3u8_url:
-                continue
-            formats.extend(self._extract_m3u8_formats(
-                m3u8_url, video_id, ext='mp4', live=is_live, m3u8_id=name))
+        formats = list(self._expand_media(video_id, get_first(movie_stores, 'media')))
+        if not formats and is_live:
+            # archived livestreams
+            cookies = self._get_cookies('https://www.openrec.tv/')
+            detail = self._download_json(
+                f'https://apiv5.openrec.tv/api/v5/movies/{video_id}/detail', video_id,
+                headers={
+                    'Origin': 'https://www.openrec.tv',
+                    'Referer': 'https://www.openrec.tv/',
+                    'access-token': try_get(cookies, lambda x: x.get('access_token').value),
+                    'uuid': try_get(cookies, lambda x: x.get('uuid').value),
+                })
+            new_media = traverse_obj(detail, ('data', 'items', ..., 'media'), get_all=False)
+            formats = list(self._expand_media(video_id, new_media))
+            is_live = False
 
         self._sort_formats(formats)
 


Test patch: