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

Code before:
from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj


class BooyahBaseIE(InfoExtractor):
    _BOOYAH_SESSION_KEY = None

    def _real_initialize(self):
        if not BooyahBaseIE._BOOYAH_SESSION_KEY:
            initial_request = self._request_webpage(
                'https://booyah.live/api/v3/auths/sessions', None, data="".encode())
            BooyahBaseIE._BOOYAH_SESSION_KEY = initial_request.getheader('booyah-session-key')

    def _get_comment_data(self, video_id):
        comment_json = self._download_json(
            f'https://booyah.live/api/v3/playbacks/{video_id}/comments/tops', video_id,
            headers={'Booyah-Session-Key': BooyahBaseIE._BOOYAH_SESSION_KEY}, fatal=False) or {}

        return [{
            'id': comment.get('comment_id'),
            'author': comment.get('from_nickname'),
            'author_id': comment.get('from_uid'),
            'author_thumbnail': comment.get('from_thumbnail'),
            'text': comment.get('content'),
            'timestamp': comment.get('create_time'),
            'like_count': comment.get('like_cnt'),
        } for comment in comment_json.get('comment_list') or ()]


class BooyahClipsIE(BooyahBaseIE):
    _VALID_URL = r'https?://booyah.live/clips/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://booyah.live/clips/13887261322952306617',
        'info_dict': {
            'id': '13887261322952306617',
            'ext': 'mp4',
            'view_count': int,
            'duration': 30,
            'channel_id': 90565760,
            'like_count': int,
            'title': 'Cayendo con estilo 😎',
            'uploader': '♡LɪꜱGΛ​MER​',

Review comment (suggestion):
```suggestion
            headers={'Booyah-Session-Key': self._BOOYAH_SESSION_KEY}, fatal=False) or {}
```

Code after:
from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj


class BooyahBaseIE(InfoExtractor):
    _BOOYAH_SESSION_KEY = None

    def _real_initialize(self):
        BooyahBaseIE._BOOYAH_SESSION_KEY = self._request_webpage(
            'https://booyah.live/api/v3/auths/sessions', None, data=b'').getheader('booyah-session-key')

    def _get_comments(self, video_id):
        comment_json = self._download_json(
            f'https://booyah.live/api/v3/playbacks/{video_id}/comments/tops', video_id,
            headers={'Booyah-Session-Key': self._BOOYAH_SESSION_KEY}, fatal=False) or {}

        return [{
            'id': comment.get('comment_id'),
            'author': comment.get('from_nickname'),
            'author_id': comment.get('from_uid'),
            'author_thumbnail': comment.get('from_thumbnail'),
            'text': comment.get('content'),
            'timestamp': comment.get('create_time'),
            'like_count': comment.get('like_cnt'),
        } for comment in comment_json.get('comment_list') or ()]


class BooyahClipsIE(BooyahBaseIE):
    _VALID_URL = r'https?://booyah.live/clips/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://booyah.live/clips/13887261322952306617',
        'info_dict': {
            'id': '13887261322952306617',
            'ext': 'mp4',
            'view_count': int,
            'duration': 30,
            'channel_id': 90565760,
            'like_count': int,
            'title': 'Cayendo con estilo 😎',
            'uploader': '♡LɪꜱGΛ​MER​',
            'comment_count': int,
            'uploader_id': '90565760',