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

Code before:
        'url': 'https://www.trutv.com/watchtrutv/east',
        'only_matching': True,
    }]
    _SOFTWARE_STATEMENT_MAP = {
        'tbs': 'eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJkZTA0NTYxZS1iMTFhLTRlYTgtYTg5NC01NjI3MGM1NmM2MWIiLCJuYmYiOjE1MzcxODkzOTAsImlzcyI6ImF1dGguYWRvYmUuY29tIiwiaWF0IjoxNTM3MTg5MzkwfQ.Z7ny66kaqNDdCHf9Y9KsV12LrBxrLkGGxlYe2XGm6qsw2T-k1OCKC1TMzeqiZP735292MMRAQkcJDKrMIzNbAuf9nCdIcv4kE1E2nqUnjPMBduC1bHffZp8zlllyrN2ElDwM8Vhwv_5nElLRwWGEt0Kaq6KJAMZA__WDxKWC18T-wVtsOZWXQpDqO7nByhfj2t-Z8c3TUNVsA_wHgNXlkzJCZ16F2b7yGLT5ZhLPupOScd3MXC5iPh19HSVIok22h8_F_noTmGzmMnIRQi6bWYWK2zC7TQ_MsYHfv7V6EaG5m1RKZTV6JAwwoJQF_9ByzarLV1DGwZxD9-eQdqswvg',
        'tntdrama': 'eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIwOTMxYTU4OS1jZjEzLTRmNjMtYTJmYy03MzhjMjE1NWU5NjEiLCJuYmYiOjE1MzcxOTA4MjcsImlzcyI6ImF1dGguYWRvYmUuY29tIiwiaWF0IjoxNTM3MTkwODI3fQ.AucKvtws7oekTXi80_zX4-BlgJD9GLvlOI9FlBCjdlx7Pa3eJ0AqbogynKMiatMbnLOTMHGjd7tTiq422unmZjBz70dhePAe9BbW0dIo7oQ57vZ-VBYw_tWYRPmON61MwAbLVlqROD3n_zURs85S8TlkQx9aNx9x_riGGELjd8l05CVa_pOluNhYvuIFn6wmrASOKI1hNEblBDWh468UWP571-fe4zzi0rlYeeHd-cjvtWvOB3bQsWrUVbK4pRmqvzEH59j0vNF-ihJF9HncmUicYONe47Mib3elfMok23v4dB1_UAlQY_oawfNcynmEnJQCcqFmbHdEwTW6gMiYsA',
    }

    def _real_extract(self, url):
        site, path, display_id = self._match_valid_url(url).groups()
        webpage = self._download_webpage(url, display_id)
        drupal_settings = self._parse_json(self._search_regex(
            r'<script[^>]+?data-drupal-selector="drupal-settings-json"[^>]*?>({.+?})</script>',
            webpage, 'drupal setting'), display_id)
        is_live = 'watchtnt' in path or 'watchtbs' in path or 'watchtrutv' in path
        video_data = next(v for v in drupal_settings['turner_playlist'] if is_live or v.get('url') == path)

        media_id = video_data['mediaID']
        title = video_data['title']
        tokenizer_query = urllib.parse.parse_qs(urllib.parse.urlparse(
            drupal_settings['ngtv_token_url']).query)

        info = self._extract_ngtv_info(
            media_id, tokenizer_query, self._SOFTWARE_STATEMENT_MAP[site], {
                'url': url,
                'site_name': {'tbs': 'TBS', 'tnt': 'TNT', 'trutv': 'truTV'}[site],
                'auth_required': video_data.get('authRequired') == '1' or is_live,
                'is_live': is_live,
            })

        thumbnails = []
        for image_id, image in video_data.get('images', {}).items():
            image_url = image.get('url')
            if not image_url or image.get('type') != 'video':
                continue
            i = {
                'id': image_id,
                'url': image_url,
            }
            mobj = re.search(r'(\d+)x(\d+)', image_url)
            if mobj:
                i.update({
                    'width': int(mobj.group(1)),
                    'height': int(mobj.group(2)),
                })
            thumbnails.append(i)

        info.update({
            'id': media_id,
            'title': title,
            'description': strip_or_none(video_data.get('descriptionNoTags') or video_data.get('shortDescriptionNoTags')),

Review comment (suggestion):
```suggestion
                'site_name': {'tbs': 'TBS', 'tntdrama': 'TNT', 'trutv': 'truTV'}[site],
```

Code after:
            'season_number': 6,
            'episode': 'Episode 12',
            'episode_number': 12,
            'timestamp': 1478276239,
            'upload_date': '20161104',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://www.tntdrama.com/shows/the-librarians-the-next-chapter/season-1/episode-10/and-going-medieval',
        'info_dict': {
            'id': 'e487b31b663a8001864f62fd20907782f7b8ccb8',
            'ext': 'mp4',
            'title': 'And Going Medieval',
            'description': 'md5:5aed0ae23a6cf148a02fe3c1be8359fa',
            'duration': 2528.0,
            'thumbnail': r're:https://images\.tntdrama\.com/tnt/.+\.(?:jpe?g|png)',
            'chapters': 'count:7',
            'season': 'Season 1',
            'season_number': 1,
            'episode': 'Episode 10',
            'episode_number': 10,
            'timestamp': 1743107520,
            'upload_date': '20250327',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'https://www.trutv.com/shows/the-carbonaro-effect/season-1/episode-1/got-the-bug-out',
        'info_dict': {
            'id': 'b457dd7458fd9e64b596355950b13a1ca799dc39',
            'ext': 'mp4',
            'title': 'Got the Bug Out',
            'description': 'md5:9eeddf6248f73517b0e5969b8a43c025',
            'duration': 1283.0,
            'thumbnail': r're:https://images\.trutv\.com/tru/.+\.(?:jpe?g|png)',
            'chapters': 'count:4',
            'season': 'Season 1',
            'season_number': 1,
            'episode': 'Episode 1',
            'episode_number': 1,
            'timestamp': 1570040829,
            'upload_date': '20191002',
            '_old_archive_ids': ['trutv b457dd7458fd9e64b596355950b13a1ca799dc39'],
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        'url': 'http://www.tntdrama.com/shows/the-alienist/clips/monster',
        'only_matching': True,
    }, {
        'url': 'http://www.tbs.com/shows/search-party/season-1/episode-1/explicit-the-mysterious-disappearance-of-the-girl-no-one-knew',
        'only_matching': True,
    }, {