Repository: yt-dlp/yt-dlp

Issue:
[boosty.to] now showing unsupported URL 
### 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.11.11** ([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

Worldwide

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

Using the test URL provided in the extractor https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/extractor/odnoklassniki.py#L195, extraction fails and results in unsupported URL. 

This extractor was recently added in #4212

### 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://boosty.to/ikakprosto/posts/56cedaca-b56a-4dfd-b3ed-98c79cfa0167']
[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.11.11 [8b64402] (zip)
[debug] Python 3.10.5 (CPython x86_64 64bit) - Linux-5.4.0-131-generic-x86_64-with-glibc2.31 (OpenSSL 1.1.1f  31 Mar 2020, glibc 2.31)
[debug] exe versions: ffmpeg 4.2.7, ffprobe 4.2.7
[debug] Optional libraries: Crypto-3.15.0, certifi-2022.09.24, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1723 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.11.11, Current version: 2022.11.11
yt-dlp is up to date (2022.11.11)
[debug] [generic] Extracting URL: https://boosty.to/ikakprosto/posts/56cedaca-b56a-4dfd-b3ed-98c79cfa0167
[generic] 56cedaca-b56a-4dfd-b3ed-98c79cfa0167: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] 56cedaca-b56a-4dfd-b3ed-98c79cfa0167: Extracting information
[debug] Looking for embeds
ERROR: Unsupported URL: https://boosty.to/ikakprosto/posts/56cedaca-b56a-4dfd-b3ed-98c79cfa0167
Traceback (most recent call last):
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1485, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1561, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/common.py", line 674, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/yt-dlp/yt_dlp/extractor/generic.py", line 2721, in _real_extract
    raise UnsupportedError(url)
yt_dlp.utils.UnsupportedError: Unsupported URL: https://boosty.to/ikakprosto/posts/56cedaca-b56a-4dfd-b3ed-98c79cfa0167
```



Discussion:
The site design has completely changed. The video is now in a `script type="text/plain" id="initial-state">`. It'll need a dedicated extractor
@pukkandan is there any example of such kind of extractor? Or it's completely new?
A lot of them extract from similar places. Just look for small extractors that uses `self._search_json`. `TVIPlayerIE` is a simple example
Hello, I would to love to know if anyone found a solution to download videos on boosty.to ? 
That site is growing everyday and it would be very nice to find one :)
Thanks to you all
> Hello, I would to love to know if anyone found a solution to download videos on boosty.to ? That site is growing everyday and it would be very nice to find one :) Thanks to you all

You can right click on video - select copy debug info - paste it to notepad - append United video id to `yt-dlp http://ok.ru/videoembed/` and it will download
nvm i made an extractor
> > Hello, I would to love to know if anyone found a solution to download videos on boosty.to ? That site is growing everyday and it would be very nice to find one :) Thanks to you all
> 
> You can right click on video - select copy debug info - paste it to notepad - append United video id to `yt-dlp http://ok.ru/videoembed/` and it will download

Hey thank you very much for your answer! I tried many things without success. 
But that worked at first try! I just tried with free video for now. i don't know if it also work same on other ones. i will try ! 

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
@@ -257,6 +257,7 @@
 from .bloomberg import BloombergIE
 from .bokecc import BokeCCIE
 from .bongacams import BongaCamsIE
+from .boosty import BoostyIE
 from .bostonglobe import BostonGlobeIE
 from .box import BoxIE
 from .boxcast import BoxCastVideoIE
diff --git a/yt_dlp/extractor/boosty.py b/yt_dlp/extractor/boosty.py
new file mode 100644
--- /dev/null
+++ b/yt_dlp/extractor/boosty.py
@@ -0,0 +1,209 @@
+from .common import InfoExtractor
+from .youtube import YoutubeIE
+from ..utils import (
+    ExtractorError,
+    int_or_none,
+    qualities,
+    str_or_none,
+    url_or_none,
+)
+from ..utils.traversal import traverse_obj
+
+
+class BoostyIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?boosty\.to/(?P<user>[^/#?]+)/posts/(?P<post_id>[^/#?]+)'
+    _TESTS = [{
+        # single ok_video
+        'url': 'https://boosty.to/kuplinov/posts/e55d050c-e3bb-4873-a7db-ac7a49b40c38',
+        'info_dict': {
+            'id': 'd7473824-352e-48e2-ae53-d4aa39459968',
+            'title': 'phasma_3',
+            'channel': 'Kuplinov',
+            'channel_id': '7958701',
+            'timestamp': 1655031975,
+            'upload_date': '20220612',
+            'release_timestamp': 1655049000,
+            'release_date': '20220612',
+            'modified_timestamp': 1668680993,
+            'modified_date': '20221117',
+            'tags': ['куплинов', 'phasmophobia'],
+            'like_count': int,
+            'ext': 'mp4',
+            'duration': 105,
+            'view_count': int,
+            'thumbnail': r're:^https://i\.mycdn\.me/videoPreview\?',
+        },
+    }, {
+        # multiple ok_video
+        'url': 'https://boosty.to/maddyson/posts/0c652798-3b35-471f-8b48-a76a0b28736f',
+        'info_dict': {
+            'id': '0c652798-3b35-471f-8b48-a76a0b28736f',
+            'title': 'то что не пропустил юта6',
+            'channel': 'Илья Давыдов',
+            'channel_id': '6808257',
+            'timestamp': 1694017040,
+            'upload_date': '20230906',
+            'release_timestamp': 1694017040,
+            'release_date': '20230906',
+            'modified_timestamp': 1694071178,
+            'modified_date': '20230907',
+            'like_count': int,
+        },
+        'playlist_count': 3,
+        'playlist': [{
+            'info_dict': {
+                'id': 'cc325a9f-a563-41c6-bf47-516c1b506c9a',
+                'title': 'то что не пропустил юта6',
+                'channel': 'Илья Давыдов',
+                'channel_id': '6808257',
+                'timestamp': 1694017040,
+                'upload_date': '20230906',
+                'release_timestamp': 1694017040,
+                'release_date': '20230906',
+                'modified_timestamp': 1694071178,
+                'modified_date': '20230907',
+                'like_count': int,
+                'ext': 'mp4',
+                'duration': 31204,
+                'view_count': int,
+                'thumbnail': r're:^https://i\.mycdn\.me/videoPreview\?',
+            },
+        }, {
+            'info_dict': {
+                'id': 'd07b0a72-9493-4512-b54e-55ce468fd4b7',
+                'title': 'то что не пропустил юта6',
+                'channel': 'Илья Давыдов',
+                'channel_id': '6808257',
+                'timestamp': 1694017040,
+                'upload_date': '20230906',
+                'release_timestamp': 1694017040,
+                'release_date': '20230906',
+                'modified_timestamp': 1694071178,
+                'modified_date': '20230907',
+                'like_count': int,
+                'ext': 'mp4',
+                'duration': 25704,
+                'view_count': int,
+                'thumbnail': r're:^https://i\.mycdn\.me/videoPreview\?',
+            },
+        }, {
+            'info_dict': {
+                'id': '4a3bba32-78c8-422a-9432-2791aff60b42',
+                'title': 'то что не пропустил юта6',
+                'channel': 'Илья Давыдов',
+                'channel_id': '6808257',
+                'timestamp': 1694017040,
+                'upload_date': '20230906',
+                'release_timestamp': 1694017040,
+                'release_date': '20230906',
+                'modified_timestamp': 1694071178,
+                'modified_date': '20230907',
+                'like_count': int,
+                'ext': 'mp4',
+                'duration': 31867,
+                'view_count': int,
+                'thumbnail': r're:^https://i\.mycdn\.me/videoPreview\?',
+            },
+        }],
+    }, {
+        # single external video (youtube)
+        'url': 'https://boosty.to/denischuzhoy/posts/6094a487-bcec-4cf8-a453-43313b463c38',
+        'info_dict': {
+            'id': 'EXelTnve5lY',
+            'title': 'Послание Президента Федеральному Собранию | Класс народа',
+            'upload_date': '20210425',
+            'channel': 'Денис Чужой',
+            'tags': 'count:10',
+            'like_count': int,
+            'ext': 'mp4',
+            'duration': 816,
+            'view_count': int,
+            'thumbnail': r're:^https://i\.ytimg\.com/',
+            'age_limit': 0,
+            'availability': 'public',
+            'categories': list,
+            'channel_follower_count': int,
+            'channel_id': 'UCCzVNbWZfYpBfyofCCUD_0w',
+            'channel_is_verified': bool,
+            'channel_url': r're:^https://www\.youtube\.com/',
+            'comment_count': int,
+            'description': str,
+            'heatmap': 'count:100',
+            'live_status': str,
+            'playable_in_embed': bool,
+            'uploader': str,
+            'uploader_id': str,
+            'uploader_url': r're:^https://www\.youtube\.com/',
+        },
+    }]
+
+    _MP4_TYPES = ('tiny', 'lowest', 'low', 'medium', 'high', 'full_hd', 'quad_hd', 'ultra_hd')
+
+    def _extract_formats(self, player_urls, video_id):
+        formats = []
+        quality = qualities(self._MP4_TYPES)
+        for player_url in traverse_obj(player_urls, lambda _, v: url_or_none(v['url'])):
+            url = player_url['url']
+            format_type = player_url.get('type')
+            if format_type in ('hls', 'hls_live', 'live_ondemand_hls', 'live_playback_hls'):
+                formats.extend(self._extract_m3u8_formats(url, video_id, m3u8_id='hls', fatal=False))
+            elif format_type in ('dash', 'dash_live', 'live_playback_dash'):
+                formats.extend(self._extract_mpd_formats(url, video_id, mpd_id='dash', fatal=False))
+            elif format_type in self._MP4_TYPES:
+                formats.append({
+                    'url': url,
+                    'ext': 'mp4',
+                    'format_id': format_type,
+                    'quality': quality(format_type),
+                })
+            else:
+                self.report_warning(f'Unknown format type: {format_type!r}')
+        return formats
+
+    def _real_extract(self, url):
+        user, post_id = self._match_valid_url(url).group('user', 'post_id')
+        post = self._download_json(
+            f'https://api.boosty.to/v1/blog/{user}/post/{post_id}', post_id,
+            note='Downloading post data', errnote='Unable to download post data')
+
+        post_title = post.get('title')
+        if not post_title:
+            self.report_warning('Unable to extract post title. Falling back to parsing html page')
+            webpage = self._download_webpage(url, video_id=post_id)
+            post_title = self._og_search_title(webpage, default=None) or self._html_extract_title(webpage)
+
+        common_metadata = {
+            'title': post_title,
+            **traverse_obj(post, {
+                'channel': ('user', 'name', {str}),
+                'channel_id': ('user', 'id', {str_or_none}),
+                'timestamp': ('createdAt', {int_or_none}),
+                'release_timestamp': ('publishTime', {int_or_none}),
+                'modified_timestamp': ('updatedAt', {int_or_none}),
+                'tags': ('tags', ..., 'title', {str}),
+                'like_count': ('count', 'likes', {int_or_none}),
+            }),
+        }
+        entries = []
+        for item in traverse_obj(post, ('data', ..., {dict})):
+            item_type = item.get('type')
+            if item_type == 'video' and url_or_none(item.get('url')):
+                entries.append(self.url_result(item['url'], YoutubeIE))
+            elif item_type == 'ok_video':
+                video_id = item.get('id') or post_id
+                entries.append({
+                    'id': video_id,
+                    'formats': self._extract_formats(item.get('playerUrls'), video_id),
+                    **common_metadata,
+                    **traverse_obj(item, {
+                        'title': ('title', {str}),
+                        'duration': ('duration', {int_or_none}),
+                        'view_count': ('viewsCounter', {int_or_none}),
+                        'thumbnail': (('previewUrl', 'defaultPreview'), {url_or_none}),
+                    }, get_all=False)})
+
+        if not entries:
+            raise ExtractorError('No videos found', expected=True)
+        if len(entries) == 1:
+            return entries[0]
+        return self.playlist_result(entries, post_id, post_title, **common_metadata)


Test patch: