Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/gettr.py (Python)

Code before:
        }
    }, {
        # quote post
        'url': 'https://gettr.com/post/pxn5b743a9',
        'only_matching': True,
    }, {
        # streaming embed
        'url': 'https://gettr.com/post/pxlu8p3b13',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        post_id = self._match_id(url)
        webpage = self._download_webpage(url, post_id)
        api_data = self._call_api('post/%s?incl="poststats|userinfo"' % post_id, post_id)

        post_data = api_data.get('data')
        user_data = try_get(api_data, lambda x: x['aux']['uinf'][post_data['uid']], dict) or {}

        if post_data.get('nfound'):
            raise ExtractorError(post_data.get('txt'), expected=True)

        player_type = post_data.get('p_type')
        shared_post_id = traverse_obj(api_data, ('aux', 'shrdpst', '_id'), ('data', 'rpstIds', 0), expected_type=str)

        if player_type and player_type == 'stream':
            return self.url_result(
                f'https://gettr.com/streaming/{post_id}', ie='GettrStreaming', video_id=post_id)

        if shared_post_id:
            return self.url_result(
                f'https://gettr.com/post/{shared_post_id}', ie='Gettr', video_id=shared_post_id)

        title = description = str_or_none(
            post_data.get('txt')
            or self._og_search_description(webpage))

        uploader = str_or_none(
            user_data.get('nickname')
            or remove_end(self._og_search_title(webpage), ' on GETTR'))

        if uploader:
            title = '%s - %s' % (uploader, title)

        if not dict_get(post_data, ['vid', 'ovid']):
            raise ExtractorError('There\'s no video in this post.')

        vid = post_data.get('vid')
        ovid = post_data.get('ovid')

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(

Review comment (suggestion):
if player_type check is not needed.
`None != 'stream'`

Code after:
    }, {
        # quote post
        'url': 'https://gettr.com/post/pxn5b743a9',
        'only_matching': True,
    }, {
        # quote with video
        'url': 'https://gettr.com/post/pxtiiz5ca2',
        'only_matching': True,
    }, {
        # streaming embed
        'url': 'https://gettr.com/post/pxlu8p3b13',
        'only_matching': True,
    }, {
        # youtube embed
        'url': 'https://gettr.com/post/pv6wp9e24c',
        'only_matching': True,
        'add_ie': ['Youtube'],
    }]

    def _real_extract(self, url):
        post_id = self._match_id(url)
        webpage = self._download_webpage(url, post_id)
        api_data = self._call_api('post/%s?incl="poststats|userinfo"' % post_id, post_id)

        post_data = api_data.get('data')
        user_data = try_get(api_data, lambda x: x['aux']['uinf'][post_data['uid']], dict) or {}

        vid = post_data.get('vid')
        ovid = post_data.get('ovid')

        if post_data.get('p_type') == 'stream':
            return self.url_result(f'https://gettr.com/streaming/{post_id}', ie='GettrStreaming', video_id=post_id)

        if not (ovid or vid):
            embed_url = url_or_none(post_data.get('prevsrc'))
            shared_post_id = traverse_obj(api_data, ('aux', 'shrdpst', '_id'), ('data', 'rpstIds', 0), expected_type=str)

            if embed_url:
                return self.url_result(embed_url)
            elif shared_post_id:
                return self.url_result(f'https://gettr.com/post/{shared_post_id}', ie='Gettr', video_id=shared_post_id)
            else:
                raise ExtractorError('There\'s no video in this post.')

        title = description = str_or_none(
            post_data.get('txt') or self._og_search_description(webpage))

        uploader = str_or_none(
            user_data.get('nickname')
            or self._search_regex(r'^(.+?) on GETTR', self._og_search_title(webpage, default=''), 'uploader', fatal=False))