Repository: yt-dlp/yt-dlp

Issue:
[Broken] viafree
## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of yt-dlp:
- First of, make sure you are using the latest version of yt-dlp. Run `yt-dlp --version` and ensure your version is 2021.08.10. If it's not, see https://github.com/yt-dlp/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in https://github.com/yt-dlp/yt-dlp.
- Search the bugtracker for similar issues: https://github.com/yt-dlp/yt-dlp. DO NOT post duplicates.
- Finally, put x into all relevant boxes like this [x] (Dont forget to delete the empty space)
-->

- [X] I'm reporting a broken site support
- [X] I've verified that I'm running yt-dlp version **2021.08.10**
- [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
- [X] I've searched the bugtracker for similar issues including closed ones


## Verbose log 0 (completely broken)

```
https://www.viafree.dk/programmer/humor/comedy-central-roast-of-charlie-sheen/saeson-1

$ yt-dlp -v https://www.viafree.dk/programmer/humor/comedy-central-roast-of-charlie-sheen/film/1047660
[debug] Command-line config: ['-v', 'https://www.viafree.dk/programmer/humor/comedy-central-roast-of-charlie-sheen/film/1047660']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] yt-dlp version 2021.08.10
[debug] Python version 3.9.6 (CPython 64bit) - Linux-5.10.61
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Optional libraries: sqlite
[debug] Proxy map: {}
[debug] [mtg] Extracting URL: https://www.viafree.dk/programmer/humor/comedy-central-roast-of-charlie-sheen/film/1047660
[mtg] 1047660: Downloading video JSON
[mtg] 1047660: Downloading streams JSON
ERROR: No video formats found; please report this issue on  https://github.com/yt-dlp/yt-dlp . Make sure you are using the latest version; see  https://github.com/yt-dlp/yt-dlp  on how to update. Be sure to call yt-dlp with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1199, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py", line 1224, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/lib/python3.9/site-packages/yt_dlp/extractor/common.py", line 575, in extract
    ie_result = self._real_extract(url)
  File "/usr/lib/python3.9/site-packages/yt_dlp/extractor/tvplay.py", line 304, in _real_extract
    self._sort_formats(formats)
  File "/usr/lib/python3.9/site-packages/yt_dlp/extractor/common.py", line 1756, in _sort_formats
    raise ExtractorError('No video formats found')
yt_dlp.utils.ExtractorError: No video formats found; please report this issue on  https://github.com/yt-dlp/yt-dlp . Make sure you are using the latest version; see  https://github.com/yt-dlp/yt-dlp  on how to update. Be sure to call yt-dlp with the --verbose flag and include its complete output.
```

## Verbose log 1 (missing subtitles)

```
https://www.viafree.dk/programmer/humor/tosh0--1/saeson-4

$ yt-dlp -v https://www.viafree.dk/programmer/humor/tosh0--1/saeson-4/episode-1
[debug] Command-line config: ['-v', 'https://www.viafree.dk/programmer/humor/tosh0--1/saeson-4/episode-1']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] yt-dlp version 2021.08.10
[debug] Python version 3.9.6 (CPython 64bit) - Linux-5.10.61
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Optional libraries: sqlite
[debug] Proxy map: {}
[debug] [Viafree] Extracting URL: https://www.viafree.dk/programmer/humor/tosh0--1/saeson-4/episode-1
[Viafree] programmer/humor/tosh0--1/saeson-4/episode-1: Downloading JSON metadata
[Viafree] 1052498: Downloading JSON metadata
[Viafree] 1052498: Downloading m3u8 information
WARNING: [Viafree] Ignoring subtitle tracks found in the HLS manifest; if any subtitle tracks are missing, please report this issue on  https://github.com/yt-dlp/yt-dlp . Make sure you are using the latest version; see  https://github.com/yt-dlp/yt-dlp  on how to update. Be sure to call yt-dlp with the --verbose flag and include its complete output.
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 1052498: Downloading 1 format(s): 4114+98
...
```

## Description

As documented in verbose log 0, some videos will not download at all. Others will download fine, but the subtitles are missing.


Discussion:

Resolving patch:
diff --git a/yt_dlp/extractor/tvplay.py b/yt_dlp/extractor/tvplay.py
--- a/yt_dlp/extractor/tvplay.py
+++ b/yt_dlp/extractor/tvplay.py
@@ -34,8 +34,8 @@ class TVPlayIE(InfoExtractor):
                                 tvplay(?:\.skaties)?\.lv(?:/parraides)?|
                                 (?:tv3play|play\.tv3)\.lt(?:/programos)?|
                                 tv3play(?:\.tv3)?\.ee/sisu|
-                                (?:tv(?:3|6|8|10)play|viafree)\.se/program|
-                                (?:(?:tv3play|viasat4play|tv6play|viafree)\.no|(?:tv3play|viafree)\.dk)/programmer|
+                                (?:tv(?:3|6|8|10)play)\.se/program|
+                                (?:(?:tv3play|viasat4play|tv6play)\.no|(?:tv3play)\.dk)/programmer|
                                 play\.nova(?:tv)?\.bg/programi
                             )
                             /(?:[^/]+/)+
@@ -223,10 +223,6 @@ class TVPlayIE(InfoExtractor):
             'url': 'http://tv3play.tv3.ee/sisu/kodu-keset-linna/238551?autostart=true',
             'only_matching': True,
         },
-        {
-            'url': 'http://www.viafree.se/program/underhallning/i-like-radio-live/sasong-1/676869',
-            'only_matching': True,
-        },
         {
             'url': 'mtg:418113',
             'only_matching': True,
@@ -359,6 +355,23 @@ class ViafreeIE(InfoExtractor):
         'params': {
             'skip_download': True,
         },
+    }, {
+        'url': 'https://www.viafree.dk/programmer/humor/comedy-central-roast-of-charlie-sheen/film/1047660',
+        'info_dict': {
+            'id': '1047660',
+            'ext': 'mp4',
+            'title': 'Comedy Central Roast of Charlie Sheen - Comedy Central Roast of Charlie Sheen',
+            'description': 'md5:ec956d941ae9fd7c65a48fd64951dc6d',
+            'series': 'Comedy Central Roast of Charlie Sheen',
+            'season_number': 1,
+            'duration': 3747,
+            'timestamp': 1608246060,
+            'upload_date': '20201217'
+        },
+        'params': {
+            'format': 'bestvideo',
+            'skip_download': True
+        }
     }, {
         # with relatedClips
         'url': 'http://www.viafree.se/program/reality/sommaren-med-youtube-stjarnorna/sasong-1/avsnitt-1',
@@ -373,13 +386,12 @@ class ViafreeIE(InfoExtractor):
     }, {
         'url': 'http://www.viafree.dk/programmer/reality/paradise-hotel/saeson-7/episode-5',
         'only_matching': True,
+    }, {
+        'url': 'http://www.viafree.se/program/underhallning/i-like-radio-live/sasong-1/676869',
+        'only_matching': True,
     }]
     _GEO_BYPASS = False
 
-    @classmethod
-    def suitable(cls, url):
-        return False if TVPlayIE.suitable(url) else super(ViafreeIE, cls).suitable(url)
-
     def _real_extract(self, url):
         country, path = self._match_valid_url(url).groups()
         content = self._download_json(
@@ -398,16 +410,16 @@ def _real_extract(self, url):
                 self.raise_geo_restricted(countries=[country])
             raise
 
-        formats = self._extract_m3u8_formats(stream_href, guid, 'mp4')
+        formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_href, guid, 'mp4')
         self._sort_formats(formats)
         episode = program.get('episode') or {}
-
         return {
             'id': guid,
             'title': title,
             'thumbnail': meta.get('image'),
             'description': meta.get('description'),
             'series': episode.get('seriesTitle'),
+            'subtitles': subtitles,
             'episode_number': int_or_none(episode.get('episodeNumber')),
             'season_number': int_or_none(episode.get('seasonNumber')),
             'duration': int_or_none(try_get(program, lambda x: x['video']['duration']['milliseconds']), 1000),


Test patch: