Repository: yt-dlp/yt-dlp

Issue:
La7 
### 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

Germany

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

Until last week downloading videos from https://www.la7.it/ worked without problems.
Now it suddenly outputs the following error. I guess it might be related to some drm issues from la7.it

### 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
$ /home/marcello/.local/bin/yt-dlp -vU "https://www.la7.it/otto-e-mezzo/rivedila7/meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308"
[debug] Command-line config: ['-vU', 'https://www.la7.it/otto-e-mezzo/rivedila7/meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.10.04 [4e0511f] (pip) API
[debug] Python 3.10.6 (CPython 64bit) - Linux-5.15.0-46-lowlatency-x86_64-with-glibc2.35 (glibc 2.35)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.11.0, brotli-1.0.9, certifi-2020.06.20, mutagen-1.45.1, pyxattr-0.7.2, secretstorage-3.3.1, sqlite3-2.6.0, websockets-9.1
[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] [la7.it] Extracting URL: https://www.la7.it/otto-e-mezzo/rivedila7/meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308
[la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: Downloading webpage
[la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: Downloading MPD manifest
WARNING: [la7.it] Failed to download MPD manifest: HTTP Error 502: Bad Gateway
[la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: Downloading m3u8 information
WARNING: [la7.it] Failed to download m3u8 information: HTTP Error 502: Bad Gateway
ERROR: [la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: 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 "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1477, in wrapper
    return func(self, *args, **kwargs)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1574, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1632, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 2569, in process_video_result
    self.raise_no_formats(info_dict)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1027, in raise_no_formats
    raise ExtractorError(msg, video_id=info['id'], ie=info['extractor'],
yt_dlp.utils.ExtractorError: [la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: 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
```

La7 
### 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

Germany

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

Until last week downloading videos from https://www.la7.it/ worked without problems.
Now it suddenly outputs the following error. I guess it might be related to some drm issues from la7.it

### 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
$ /home/marcello/.local/bin/yt-dlp -vU "https://www.la7.it/otto-e-mezzo/rivedila7/meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308"
[debug] Command-line config: ['-vU', 'https://www.la7.it/otto-e-mezzo/rivedila7/meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.10.04 [4e0511f] (pip) API
[debug] Python 3.10.6 (CPython 64bit) - Linux-5.15.0-46-lowlatency-x86_64-with-glibc2.35 (glibc 2.35)
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 4.4.2 (setts), ffprobe 4.4.2, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.11.0, brotli-1.0.9, certifi-2020.06.20, mutagen-1.45.1, pyxattr-0.7.2, secretstorage-3.3.1, sqlite3-2.6.0, websockets-9.1
[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] [la7.it] Extracting URL: https://www.la7.it/otto-e-mezzo/rivedila7/meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308
[la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: Downloading webpage
[la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: Downloading MPD manifest
WARNING: [la7.it] Failed to download MPD manifest: HTTP Error 502: Bad Gateway
[la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: Downloading m3u8 information
WARNING: [la7.it] Failed to download m3u8 information: HTTP Error 502: Bad Gateway
ERROR: [la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: 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 "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1477, in wrapper
    return func(self, *args, **kwargs)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1574, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1632, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 2569, in process_video_result
    self.raise_no_formats(info_dict)
  File "/home/marcello/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1027, in raise_no_formats
    raise ExtractorError(msg, video_id=info['id'], ie=info['extractor'],
yt_dlp.utils.ExtractorError: [la7.it] meloni-fiducia-tra-programma-e-comizio-otto-e-mezzo-puntata-del-25102022-25-10-2022-457308: 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:
A regex, even though not greedy, is matching an entire chunk of HTML
```
/content/servizio-di-notifiche-push" title="LA7 Notifiche Push">..."contentUrl":"https://awsvodpkg.iltrovatore.it/content/entry/data/0/532/0_hgc8sxtm_0_173lcsvm_1
```
and needs to be curtailed:
```diff
--- old/yt_dlp/extractor/la7.py
+++ new/yt_dlp/extractor/la7.py
@@ -63,7 +63,7 @@
             url = '%s//%s' % (self.http_scheme(), url)
 
         webpage = self._download_webpage(url, video_id)
-        video_path = self._search_regex(r'(/content/.*?).mp4', webpage, 'video_path')
+        video_path = self._search_regex(r'(/content/\S+?)\.mp4', webpage, 'video_path')
 
         formats = self._extract_mpd_formats(
             f'{self._HOST}/local/dash/,{video_path}.mp4.urlset/manifest.mpd',
```
(there's also an unescaped `.`)

Actually, if this is always the target the extractor should extract the ld+json block and use its `['url']` value instead of searching blindly.
A regex, even though not greedy, is matching an entire chunk of HTML
```
/content/servizio-di-notifiche-push" title="LA7 Notifiche Push">..."contentUrl":"https://awsvodpkg.iltrovatore.it/content/entry/data/0/532/0_hgc8sxtm_0_173lcsvm_1
```
and needs to be curtailed:
```diff
--- old/yt_dlp/extractor/la7.py
+++ new/yt_dlp/extractor/la7.py
@@ -63,7 +63,7 @@
             url = '%s//%s' % (self.http_scheme(), url)
 
         webpage = self._download_webpage(url, video_id)
-        video_path = self._search_regex(r'(/content/.*?).mp4', webpage, 'video_path')
+        video_path = self._search_regex(r'(/content/\S+?)\.mp4', webpage, 'video_path')
 
         formats = self._extract_mpd_formats(
             f'{self._HOST}/local/dash/,{video_path}.mp4.urlset/manifest.mpd',
```
(there's also an unescaped `.`)

Actually, if this is always the target the extractor should extract the ld+json block and use its `['url']` value instead of searching blindly.

Resolving patch:
diff --git a/yt_dlp/extractor/la7.py b/yt_dlp/extractor/la7.py
--- a/yt_dlp/extractor/la7.py
+++ b/yt_dlp/extractor/la7.py
@@ -2,7 +2,6 @@
 
 from .common import InfoExtractor
 from ..utils import (
-    determine_ext,
     float_or_none,
     HEADRequest,
     int_or_none,
@@ -13,13 +12,13 @@
 
 class LA7IE(InfoExtractor):
     IE_NAME = 'la7.it'
-    _VALID_URL = r'''(?x)(https?://)?(?:
-        (?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video)/|
+    _VALID_URL = r'''(?x)https?://(?:
+        (?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video|news)/|
         tg\.la7\.it/repliche-tgla7\?id=
     )(?P<id>.+)'''
 
     _TESTS = [{
-        # 'src' is a plain URL
+        # single quality video
         'url': 'http://www.la7.it/crozza/video/inccool8-02-10-2015-163722',
         'md5': '8b613ffc0c4bf9b9e377169fc19c214c',
         'info_dict': {
@@ -29,6 +28,20 @@ class LA7IE(InfoExtractor):
             'description': 'Benvenuti nell\'incredibile mondo della INC. COOL. 8. dove “INC.” sta per “Incorporated” “COOL” sta per “fashion” ed Eight sta per il gesto atletico',
             'thumbnail': 're:^https?://.*',
             'upload_date': '20151002',
+            'formats': 'count:4',
+        },
+    }, {
+        # multiple quality video
+        'url': 'https://www.la7.it/calcio-femminile/news/il-gol-di-lindsey-thomas-fiorentina-vs-milan-serie-a-calcio-femminile-26-11-2022-461736',
+        'md5': 'd2370e78f75e8d1238cb3a0db9a2eda3',
+        'info_dict': {
+            'id': 'il-gol-di-lindsey-thomas-fiorentina-vs-milan-serie-a-calcio-femminile-26-11-2022-461736',
+            'ext': 'mp4',
+            'title': 'Il gol di Lindsey Thomas | Fiorentina vs Milan | Serie A Calcio Femminile',
+            'description': 'Il gol di Lindsey Thomas | Fiorentina vs Milan | Serie A Calcio Femminile',
+            'thumbnail': 're:^https?://.*',
+            'upload_date': '20221126',
+            'formats': 'count:8',
         },
     }, {
         'url': 'http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077',
@@ -39,7 +52,7 @@ class LA7IE(InfoExtractor):
     def _generate_mp4_url(self, quality, m3u8_formats):
         for f in m3u8_formats:
             if f['vcodec'] != 'none' and quality in f['url']:
-                http_url = '%s%s.mp4' % (self._HOST, quality)
+                http_url = f'{self._HOST}{quality}.mp4'
 
                 urlh = self._request_webpage(
                     HEADRequest(http_url), quality,
@@ -58,12 +71,13 @@ def _generate_mp4_url(self, quality, m3u8_formats):
 
     def _real_extract(self, url):
         video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
 
-        if not url.startswith('http'):
-            url = '%s//%s' % (self.http_scheme(), url)
+        if re.search(r'(?i)(drmsupport\s*:\s*true)\s*', webpage):
+            self.report_drm(video_id)
 
-        webpage = self._download_webpage(url, video_id)
-        video_path = self._search_regex(r'(/content/.*?).mp4', webpage, 'video_path')
+        video_path = self._search_regex(
+            r'(/content/[\w/,]+?)\.mp4(?:\.csmil)?/master\.m3u8', webpage, 'video_path')
 
         formats = self._extract_mpd_formats(
             f'{self._HOST}/local/dash/,{video_path}.mp4.urlset/manifest.mpd',
@@ -90,8 +104,7 @@ def _real_extract(self, url):
 
 class LA7PodcastEpisodeIE(InfoExtractor):
     IE_NAME = 'la7.it:pod:episode'
-    _VALID_URL = r'''(?x)(https?://)?
-        (?:www\.)?la7\.it/[^/]+/podcast/([^/]+-)?(?P<id>\d+)'''
+    _VALID_URL = r'https?://(?:www\.)?la7\.it/[^/]+/podcast/([^/]+-)?(?P<id>\d+)'
 
     _TESTS = [{
         'url': 'https://www.la7.it/voicetown/podcast/la-carezza-delle-memoria-di-carlo-verdone-23-03-2021-371497',
@@ -125,14 +138,15 @@ def _extract_info(self, webpage, video_id=None, ppn=None):
                 webpage, 'video_id', group='vid')
 
         media_url = self._search_regex(
-            (r'src:\s*([\'"])(?P<url>.+?mp3.+?)\1',
-             r'data-podcast=([\'"])(?P<url>.+?mp3.+?)\1'),
+            (r'src\s*:\s*([\'"])(?P<url>\S+?mp3.+?)\1',
+             r'data-podcast\s*=\s*([\'"])(?P<url>\S+?mp3.+?)\1'),
             webpage, 'media_url', group='url')
-        ext = determine_ext(media_url)
         formats = [{
             'url': media_url,
-            'format_id': ext,
-            'ext': ext,
+            'format_id': 'http-mp3',
+            'ext': 'mp3',
+            'acodec': 'mp3',
+            'vcodec': 'none',
         }]
 
         title = self._html_search_regex(
@@ -173,7 +187,7 @@ def _extract_info(self, webpage, video_id=None, ppn=None):
         # and title is the same as the show_title
         # add the date to the title
         if date and not date_alt and ppn and ppn.lower() == title.lower():
-            title += ' del %s' % date
+            title = f'{title} del {date}'
         return {
             'id': video_id,
             'title': title,
@@ -193,7 +207,7 @@ def _real_extract(self, url):
 
 class LA7PodcastIE(LA7PodcastEpisodeIE):  # XXX: Do not subclass from concrete IE
     IE_NAME = 'la7.it:podcast'
-    _VALID_URL = r'(https?://)?(www\.)?la7\.it/(?P<id>[^/]+)/podcast/?(?:$|[#?])'
+    _VALID_URL = r'https?://(?:www\.)?la7\.it/(?P<id>[^/]+)/podcast/?(?:$|[#?])'
 
     _TESTS = [{
         'url': 'https://www.la7.it/propagandalive/podcast',
@@ -201,7 +215,7 @@ class LA7PodcastIE(LA7PodcastEpisodeIE):  # XXX: Do not subclass from concrete I
             'id': 'propagandalive',
             'title': "Propaganda Live",
         },
-        'playlist_count': 10,
+        'playlist_count_min': 10,
     }]
 
     def _real_extract(self, url):


Test patch: