Repository: yt-dlp/yt-dlp

Issue:
[Gettr] add support for /stream/ link type
### Checklist

- [X] I'm reporting a site feature request
- [X] I've verified that I'm running yt-dlp version **2022.02.04**. ([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 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

### Example URLs

https://www.gettr.com/post/pcf6uv838f



### Description

Not a live stream, as far as I can tell. 
Stream is stored within an M3U format link:
https://stream.video.gettr.com/JJSJpD3t6QuFXedEGf73pdq8ZAfHcvqC022phY4T00qnE.m3u8

No geo restriction, from what I can tell. 
Would be a great improvement to an existing Gettr extractor.
If any testing needed, I'm glad to help.


### Verbose log

```shell
ERROR: Unsupported URL: https://gettr.com/streaming/psoiulc122
```



Discussion:

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
@@ -538,7 +538,10 @@
 from .gdcvault import GDCVaultIE
 from .gedidigital import GediDigitalIE
 from .generic import GenericIE
-from .gettr import GettrIE
+from .gettr import (
+    GettrIE,
+    GettrStreamingIE,
+)
 from .gfycat import GfycatIE
 from .giantbomb import GiantBombIE
 from .giga import GigaIE
diff --git a/yt_dlp/extractor/gettr.py b/yt_dlp/extractor/gettr.py
--- a/yt_dlp/extractor/gettr.py
+++ b/yt_dlp/extractor/gettr.py
@@ -3,6 +3,7 @@
 
 from .common import InfoExtractor
 from ..utils import (
+    bool_or_none,
     ExtractorError,
     dict_get,
     float_or_none,
@@ -15,10 +16,17 @@
 )
 
 
-class GettrIE(InfoExtractor):
-    _VALID_URL = r'https?://(www\.)?gettr\.com/post/(?P<id>[a-z0-9]+)'
+class GettrBaseIE(InfoExtractor):
+    _BASE_REGEX = r'https?://(www\.)?gettr\.com/'
     _MEDIA_BASE_URL = 'https://media.gettr.com/'
 
+    def _call_api(self, path, video_id, *args, **kwargs):
+        return self._download_json(urljoin('https://api.gettr.com/u/', path), video_id, *args, **kwargs)['result']
+
+
+class GettrIE(GettrBaseIE):
+    _VALID_URL = GettrBaseIE._BASE_REGEX + r'post/(?P<id>[a-z0-9]+)'
+
     _TESTS = [{
         'url': 'https://www.gettr.com/post/pcf6uv838f',
         'info_dict': {
@@ -51,11 +59,10 @@ def _real_extract(self, url):
         post_id = self._match_id(url)
         webpage = self._download_webpage(url, post_id)
 
-        api_data = self._download_json(
-            'https://api.gettr.com/u/post/%s?incl="poststats|userinfo"' % post_id, post_id)
+        api_data = self._call_api('post/%s?incl="poststats|userinfo"' % post_id, post_id)
 
-        post_data = try_get(api_data, lambda x: x['result']['data'])
-        user_data = try_get(api_data, lambda x: x['result']['aux']['uinf'][post_data['uid']]) or {}
+        post_data = api_data.get('data')
+        user_data = try_get(api_data, lambda x: x['aux']['uinf'][post_data['uid']]) or {}
 
         if post_data.get('nfound'):
             raise ExtractorError(post_data.get('txt'), expected=True)
@@ -108,3 +115,71 @@ def _real_extract(self, url):
             'duration': float_or_none(post_data.get('vid_dur')),
             'tags': post_data.get('htgs'),
         }
+
+
+class GettrStreamingIE(GettrBaseIE):
+    _VALID_URL = GettrBaseIE._BASE_REGEX + r'streaming/(?P<id>[a-z0-9]+)'
+
+    _TESTS = [{
+        'url': 'https://gettr.com/streaming/psoiulc122',
+        'info_dict': {
+            'id': 'psoiulc122',
+            'ext': 'mp4',
+            'description': 'md5:56bca4b8f48f1743d9fd03d49c723017',
+            'view_count': int,
+            'uploader': 'Corona Investigative Committee',
+            'uploader_id': 'coronacommittee',
+            'duration': 5180.184,
+            'thumbnail': r're:^https?://.+',
+            'title': 'Day 1: Opening Session of the Grand Jury Proceeding',
+            'timestamp': 1644080997.164,
+            'upload_date': '20220205',
+        }
+    }, {
+        'url': 'https://gettr.com/streaming/psfmeefcc1',
+        'info_dict': {
+            'id': 'psfmeefcc1',
+            'ext': 'mp4',
+            'title': 'Session 90: "The Virus Of Power"',
+            'view_count': int,
+            'uploader_id': 'coronacommittee',
+            'description': 'md5:98986acdf656aa836bf36f9c9704c65b',
+            'uploader': 'Corona Investigative Committee',
+            'thumbnail': r're:^https?://.+',
+            'duration': 21872.507,
+            'timestamp': 1643976662.858,
+            'upload_date': '20220204',
+        }
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        video_info = self._call_api('live/join/%s' % video_id, video_id, data={})
+
+        live_info = video_info['broadcast']
+        live_url = url_or_none(live_info.get('url'))
+
+        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
+            live_url, video_id, ext='mp4',
+            entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) if live_url else ([], {})
+
+        thumbnails = [{
+            'url': urljoin(self._MEDIA_BASE_URL, thumbnail),
+        } for thumbnail in try_get(video_info, lambda x: x['postData']['imgs']) or []]
+
+        self._sort_formats(formats)
+
+        return {
+            'id': video_id,
+            'title': try_get(video_info, lambda x: x['postData']['ttl']),
+            'description': try_get(video_info, lambda x: x['postData']['dsc']),
+            'formats': formats,
+            'subtitles': subtitles,
+            'thumbnails': thumbnails,
+            'uploader': try_get(video_info, lambda x: x['liveHostInfo']['nickname']),
+            'uploader_id': try_get(video_info, lambda x: x['liveHostInfo']['_id']),
+            'view_count': int_or_none(live_info.get('viewsCount')),
+            'timestamp': float_or_none(live_info.get('startAt'), scale=1000),
+            'duration': float_or_none(live_info.get('duration'), scale=1000),
+            'is_live': bool_or_none(live_info.get('isLive')),
+        }


Test patch: