Repository: yt-dlp/yt-dlp

Issue:
[Cineteca Milano] Add support for cinetecamilano.it.
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a new site support request
- [X] I've verified that I'm running yt-dlp version **2022.09.01** ([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 checked that none of provided URLs [violate any copyrights](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy) or contain any [DRM](https://en.wikipedia.org/wiki/Digital_rights_management) to the best of my knowledge
- [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 am willing to share it if required

### Region

_No response_

### Example URLs

https://www.cinetecamilano.it/film/1580

### Provide a description that is worded well enough to be understood

[Account credentials](http://bugmenot.com/view/cinetecamilano.it)

I was able to extract a downloadable link with [_The Stream Detector_](https://addons.mozilla.org/firefox/addon/hls-stream-detector): https://www.cinetecamilano.it/storage/drm/5f195bce16b3a/hls.m3u8

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '--ffmpeg-location', 'C:\\Program Files\\ffmpeg-master-latest-win64-gpl\\bin', '--cookies-from-browser', 'chrome', 'https://www.cinetecamilano.it/film/1580']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] yt-dlp version 2022.09.01 [5d7c7d6] (win32_exe)
[debug] Python 3.8.10 (CPython 64bit) - Windows-8.1-6.3.9600-SP0
[debug] Checking exe version: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffmpeg" -bsfs
[debug] Checking exe version: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffprobe" -bsfs
[debug] exe versions: ffmpeg N-106989-gb033913d1c-20220524 (setts), ffprobe N-106989-gb033913d1c-20220524
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[Cookies] Extracting cookies from chrome
[debug] Extracting cookies from: "C:\Users\Redacted\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies"
[debug] Found local state file at "C:\Users\Redacted\AppData\Local\Google\Chrome\User Data\Local State"
[Cookies] Extracted 3010 cookies from chrome
[debug] cookie version breakdown: {'v10': 3010, 'other': 0, 'unencrypted': 0}
[debug] Proxy map: {}
[debug] Loaded 1670 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.09.01, Current version: 2022.09.01
yt-dlp is up to date (2022.09.01)
[debug] [generic] Extracting URL: https://www.cinetecamilano.it/film/1580
[generic] 1580: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] 1580: Extracting information
[debug] Looking for Brightcove embeds
[debug] Looking for embeds
ERROR: Unsupported URL: https://www.cinetecamilano.it/film/1580
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 1459, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1535, in __extract_info
  File "yt_dlp\extractor\common.py", line 670, in extract
  File "yt_dlp\extractor\generic.py", line 3078, in _real_extract
yt_dlp.utils.UnsupportedError: Unsupported URL: https://www.cinetecamilano.it/film/1580

Using the extracted m3u8 link:
[debug] Command-line config: ['-vU', '--ffmpeg-location', 'C:\\Program Files\\ffmpeg-master-latest-win64-gpl\\bin', 'https://www.cinetecamilano.it/storage/drm/5f195bce16b3a/hls.m3u8']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] yt-dlp version 2022.09.01 [5d7c7d6] (win32_exe)
[debug] Python 3.8.10 (CPython 64bit) - Windows-8.1-6.3.9600-SP0
[debug] Checking exe version: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffmpeg" -bsfs
[debug] Checking exe version: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffprobe" -bsfs
[debug] exe versions: ffmpeg N-106989-gb033913d1c-20220524 (setts), ffprobe N-106989-gb033913d1c-20220524
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
[debug] Loaded 1670 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.09.01, Current version: 2022.09.01
yt-dlp is up to date (2022.09.01)
[debug] [generic] Extracting URL: https://www.cinetecamilano.it/storage/drm/5f195bce16b3a/hls.m3u8
[generic] hls: Downloading webpage
[debug] Identified a direct video link
[generic] hls: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] hls: Downloading 1 format(s): 1080
[debug] Invoking hlsnative downloader on "https://www.cinetecamilano.it/storage/drm/5f195bce16b3a/hls_1080p.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 175
[download] Destination: hls [hls].mp4
[debug] File locking is not supported. Proceeding without locking
[download] 100% of 324.38MiB in 01:59 at 2.72MiB/s
[debug] ffprobe command line: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffprobe" -hide_banner -show_format -show_streams -print_format json "file:hls [hls].mp4"
[FixupM3u8] Fixing MPEG-TS in MP4 container of "hls [hls].mp4"
[debug] ffmpeg command line: "C:\Program Files\ffmpeg-master-latest-win64-gpl\bin\ffmpeg" -y -loglevel "repeat+info" -i "file:hls [hls].mp4" -map 0 -dn -ignore_unknown -c copy -f mp4 "-bsf:a" aac_adtstoasc -movflags "+faststart" "file:hls [hls].temp.mp4"
```

Rumble download says "No video formats found"
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2022.10.04** ([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 checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#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

USA

### Provide a description that is worded well enough to be understood

If I go to https://rumble.com/v1mya66-darrell-brooks-trial-day-2-prosecution-witnesses-waukesha-parade-killer.html in a browser and click Play, the video plays. So I expected that yt-dlp, given that URL, would download the video, just like it does with YouTube videos. However, yt-dlp gives a "No video formats found" error.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', 'https://rumble.com/v1mya66-darrell-brooks-trial-day-2-prosecution-witnesses-waukesha-parade-killer.html']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version 2022.10.04 [4e0511f] (zip)
[debug] Python 3.9.13 (CPython 64bit) - macOS-11.7-x86_64-i386-64bit 
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 5.1 (setts), ffprobe 5.1, rtmpdump 2.4
[debug] Optional libraries: certifi-2021.10.08, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1690 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.10.04, Current version: 2022.10.04
yt-dlp is up to date (2022.10.04)
[debug] [generic] Extracting URL: https://rumble.com/v1mya66-darrell-brooks-trial-day-2-prosecution-witnesses-waukesha-parade-killer.html
[generic] v1mya66-darrell-brooks-trial-day-2-prosecution-witnesses-waukesha-parade-killer: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] v1mya66-darrell-brooks-trial-day-2-prosecution-witnesses-waukesha-parade-killer: Extracting information
[debug] Looking for Brightcove embeds
[debug] Looking for embeds
[debug] Identified a RumbleEmbed embed
[debug] [RumbleEmbed] Extracting URL: https://rumble.com/embed/v1kc4bq
[RumbleEmbed] v1kc4bq: Downloading JSON metadata
ERROR: [RumbleEmbed] v1kc4bq: No video formats found!; 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
Traceback (most recent call last):
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1477, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1574, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1632, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2569, in process_video_result
    self.raise_no_formats(info_dict)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1027, in raise_no_formats
    raise ExtractorError(msg, video_id=info['id'], ie=info['extractor'],
yt_dlp.utils.ExtractorError: [RumbleEmbed] v1kc4bq: No video formats found!; 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
```



Discussion:
Related upstream issue: https://github.com/ytdl-org/youtube-dl/issues/26944

For devs:

m3u8 streaming url and other metadata can be obtained via a request to `https://www.cinetecamilano.it/api/catalogo/<video id from url>` 

There seems to be reference to vimeo but it doesn't seem to use it.
I have sent several get requests to the mentioned api but I didnt get any response. Are you sure the api is correct? and if yes, is there any other way to obtain the metadata? 

> I have sent several get requests to the mentioned api but I didnt get any response. Are you sure the api is correct? and if yes, is there any other way to obtain the metadata?

You'll need to log in with an account (see the one OP posted) and look for the request to that API url in the browser developer tools. It may require extra parameters.

Maybe make sure you are also sending cookies.
This works for me now, with the same version of yt-dlp. Maybe videos created with Rumble's livestreaming feature require some post-processing on Rumble's end before they can be downloaded with yt-dlp.

Resolving patch:
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py
--- a/yt_dlp/extractor/_extractors.py
+++ b/yt_dlp/extractor/_extractors.py
@@ -319,6 +319,7 @@
 )
 from .cinchcast import CinchcastIE
 from .cinemax import CinemaxIE
+from .cinetecamilano import CinetecaMilanoIE
 from .ciscolive import (
     CiscoLiveSessionIE,
     CiscoLiveSearchIE,
diff --git a/yt_dlp/extractor/cinetecamilano.py b/yt_dlp/extractor/cinetecamilano.py
new file mode 100644
--- /dev/null
+++ b/yt_dlp/extractor/cinetecamilano.py
@@ -0,0 +1,61 @@
+import json
+import urllib.error
+from .common import InfoExtractor
+from ..utils import (
+    ExtractorError,
+    float_or_none,
+    parse_iso8601,
+    strip_or_none,
+    traverse_obj,
+    try_get,
+    urljoin,
+)
+
+
+class CinetecaMilanoIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?cinetecamilano\.it/film/(?P<id>\d+)'
+    _TESTS = [{
+        'url': 'https://www.cinetecamilano.it/film/1942',
+        'info_dict': {
+            'id': '1942',
+            'ext': 'mp4',
+            'title': 'Il draghetto Gris\u00f9 (4 episodi)',
+            'release_date': '20220129',
+            'thumbnail': r're:.+\.png',
+            'description': 'md5:5328cbe080b93224712b6f17fcaf2c01',
+            'modified_date': '20200520',
+            'duration': 3139,
+            'release_timestamp': 1643446208,
+            'modified_timestamp': int
+        }
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        try:
+            film_json = self._download_json(
+                f'https://www.cinetecamilano.it/api/catalogo/{video_id}/?',
+                video_id, headers={
+                    'Referer': url,
+                    'Authorization': try_get(self._get_cookies('https://www.cinetecamilano.it'), lambda x: f'Bearer {x["cnt-token"].value}') or ''
+                })
+        except ExtractorError as e:
+            if ((isinstance(e.cause, urllib.error.HTTPError) and e.cause.code == 500)
+                    or isinstance(e.cause, json.JSONDecodeError)):
+                self.raise_login_required(method='cookies')
+            raise
+        if not film_json.get('success') or not film_json.get('archive'):
+            raise ExtractorError('Video information not found')
+        archive = film_json['archive']
+
+        return {
+            'id': video_id,
+            'title': archive.get('title'),
+            'description': strip_or_none(archive.get('description')),
+            'duration': float_or_none(archive.get('duration'), invscale=60),
+            'release_timestamp': parse_iso8601(archive.get('updated_at'), delimiter=' '),
+            'modified_timestamp': parse_iso8601(archive.get('created_at'), delimiter=' '),
+            'thumbnail': urljoin(url, try_get(archive, lambda x: x['thumb']['src'].replace('/public/', '/storage/'))),
+            'formats': self._extract_m3u8_formats(
+                urljoin(url, traverse_obj(archive, ('drm', 'hls'))), video_id, 'mp4')
+        }


Test patch: