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

Code before:
from .streaks import StreaksBaseIE
from ..utils import (
    clean_html,
    int_or_none,
    str_or_none,
    unified_timestamp,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class TBSJPBaseIE(StreaksBaseIE):
    def _window_app(self, webpage, name, item_id, fatal=True):
        return self._search_json(r'window\.app\s*=', webpage, f'{name} info', item_id, fatal=fatal, default={})


class TBSJPEpisodeIE(TBSJPBaseIE):
    _VALID_URL = r'https?://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)'
    _TESTS = [{
        'url': 'https://cu.tbs.co.jp/episode/14694_2090934_1000117476',
        'skip': 'geo-blocked to japan + 7-day expiry',
        'info_dict': {
            'title': '次世代リアクション王発掘トーナメント',
            'id': '14694_2090934_1000117476',
            'ext': 'mp4',
            'display_id': 'ref:14694_2090934_1000117476',
            'description': 'md5:0f57448221519627dce7802432729159',
            'uploader': 'TBS',
            'uploader_id': 'tbs',
            'duration': 2761,
            'thumbnail': 'md5:76882f287053dfec6a5adffad70ff1e3',
            'categories': ['エンタメ', '水曜日のダウンタウン', 'ダウンタウン', '浜田雅功', '松本人志', '水ダウ', 'バラエティ', '動画'],
            'cast': ['浜田\u3000雅功', '千原\u3000ジュニア', 'くっきー！（野性爆弾）', '田中\u3000卓志', '菊地\u3000亜美', '池田\u3000美優', '服部\u3000潤'],
            'genres': ['variety'],
            'series': '水曜日のダウンタウン',
            'series_id': '14694',
            'episode': '次世代リアクション王発掘トーナメント',
            'episode_number': 335,
            'episode_id': '14694_2090934_1000117476',

Review comment (refactor):
- to stick with convention let's begin the method name with a verb
- passing a `default` value other than `NO_DEFAULT` to `_search_json()` will always result in `fatal=False`. let's simplify by just using `**kwargs` instead
```suggestion
    def _search_window_app_json(self, webpage, name, item_id, **kwargs):
        return self._search_json(r'window\.app\s*=', webpage, f'{name} info', item_id, **kwargs)
```

Code after:
from .streaks import StreaksBaseIE
from ..utils import (
    clean_html,
    int_or_none,
    str_or_none,
    unified_timestamp,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class TBSJPBaseIE(StreaksBaseIE):
    def _search_window_app_json(self, webpage, name, item_id, **kwargs):
        return self._search_json(r'window\.app\s*=', webpage, f'{name} info', item_id, **kwargs)


class TBSJPEpisodeIE(TBSJPBaseIE):
    _VALID_URL = r'https?://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)'
    _TESTS = [{
        'url': 'https://cu.tbs.co.jp/episode/14694_2094162_1000123656',
        'skip': 'geo-blocked to japan + 7-day expiry',
        'info_dict': {
            'title': 'クロちゃん、寝て起きたら川のほとりにいてその向こう岸に亡くなった父親がいたら死の淵にいるかと思う説 ほか',
            'id': '14694_2094162_1000123656',
            'ext': 'mp4',
            'display_id': 'ref:14694_2094162_1000123656',
            'description': 'md5:1a82fcdeb5e2e82190544bb72721c46e',
            'uploader': 'TBS',
            'uploader_id': 'tbs',
            'duration': 2752,
            'thumbnail': 'md5:d8855c8c292683c95a84cafdb42300bc',
            'categories': ['エンタメ', '水曜日のダウンタウン', 'ダウンタウン', '浜田雅功', '松本人志', '水ダウ', '動画', 'バラエティ'],
            'cast': ['浜田 雅功', '藤本 敏史', 'ビビる 大木', '千原 ジュニア', '横澤 夏子', 'せいや', 'あの', '服部 潤'],
            'genres': ['variety'],
            'series': '水曜日のダウンタウン',
            'series_id': '14694',
            'episode': 'クロちゃん、寝て起きたら川のほとりにいてその向こう岸に亡くなった父親がいたら死の淵にいるかと思う説 ほか',
            'episode_number': 341,
            'episode_id': '14694_2094162_1000123656',