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

Code before:
            'timestamp': 1756975909,
            'upload_date': '20250904',
            'uploader': '中京テレビ',
            'uploader_id': 'locipo-prod',
        },
        'params': {'noplaylist': True},
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        playlist_id = traverse_obj(parse_qs(url), ('list', -1, {str}))
        if self._yes_playlist(playlist_id, video_id):
            return self.url_result(
                f'{self._BASE_URL}/playlist/{playlist_id}', LocipoPlaylistIE)

        creatives = self._call_api(f'creatives/{video_id}', video_id, 'Creatives')
        media_id = traverse_obj(creatives, ('media_id', {str}, {require('Streaks media ID')}))

        webpage = self._download_webpage(url, video_id)
        config = self._search_json(
            r'window\.__NUXT__\.config\s*=', webpage, 'config', video_id, transform_source=js_to_json)
        api_key = traverse_obj(config, ('public', 'streaksVodPlaybackApiKey', {str}, {require('api key')}))

        return {
            **self._extract_from_streaks_api('locipo-prod', media_id, headers={
                'Origin': 'https://locipo.jp', 'X-Streaks-Api-Key': api_key}),
            **traverse_obj(creatives, {
                'title': ('name', {clean_html}),
                'description': ('description', {clean_html}, filter),
                'release_timestamp': ('publication_started_at', {parse_iso8601}),
                'tags': ('keyword', {clean_html}, {lambda x: x.split(',')}, ..., {str.strip}, filter),
                'uploader': ('company', 'name', {clean_html}, filter),
            }),
            **traverse_obj(creatives, ('series', {
                'series': ('name', {clean_html}, filter),
                'series_id': ('id', {str_or_none}),
            })),
            'id': video_id,
        }


class LocipoPlaylistIE(LocipoBaseIE):
    _PAGE_SIZE = 100
    _VALID_URL = fr'https?://locipo\.jp/(?P<type>playlist|series)/(?P<id>{LocipoBaseIE._UUID_RE}|\d+)'
    _TESTS = [{
        'url': 'https://locipo.jp/playlist/35d3dd2b-531d-4824-8575-b1c527d29538',
        'info_dict': {
            'id': '35d3dd2b-531d-4824-8575-b1c527d29538',
            'title': 'レシピ集',
        },
        'playlist_mincount': 135,

Review comment (refactor):
```suggestion
            **self._extract_from_streaks_api('locipo-prod', media_id, headers={
                'Origin': self._BASE_URL,
                'X-Streaks-Api-Key': api_key,
            }),
```

Code after:
            'uploader_id': 'locipo-prod',
        },
        'params': {'noplaylist': True},
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        playlist_id = traverse_obj(parse_qs(url), ('list', -1, {str}))
        if self._yes_playlist(playlist_id, video_id):
            return self.url_result(
                f'{self._BASE_URL}/playlist/{playlist_id}', LocipoPlaylistIE)

        creatives = self._call_api(f'creatives/{video_id}', video_id, 'Creatives')
        media_id = traverse_obj(creatives, ('media_id', {str}, {require('Streaks media ID')}))

        webpage = self._download_webpage(url, video_id)
        config = self._search_json(
            r'window\.__NUXT__\.config\s*=', webpage, 'config', video_id, transform_source=js_to_json)
        api_key = traverse_obj(config, ('public', 'streaksVodPlaybackApiKey', {str}, {require('api key')}))

        return {
            **self._extract_from_streaks_api('locipo-prod', media_id, headers={
                'Origin': 'https://locipo.jp',
                'X-Streaks-Api-Key': api_key,
            }),
            **traverse_obj(creatives, {
                'title': ('name', {clean_html}),
                'description': ('description', {clean_html}, filter),
                'release_timestamp': ('publication_started_at', {parse_iso8601}),
                'tags': ('keyword', {clean_html}, {lambda x: x.split(',')}, ..., {str.strip}, filter),
                'uploader': ('company', 'name', {clean_html}, filter),
            }),
            **traverse_obj(creatives, ('series', {
                'series': ('name', {clean_html}, filter),
                'series_id': ('id', {str_or_none}),
            })),
            'id': video_id,
        }


class LocipoPlaylistIE(LocipoBaseIE):
    _VALID_URL = [
        fr'https?://locipo\.jp/(?P<type>playlist)/(?P<id>{LocipoBaseIE._UUID_RE})',
        r'https?://locipo\.jp/(?P<type>series)/(?P<id>\d+)',
    ]
    _TESTS = [{
        'url': 'https://locipo.jp/playlist/35d3dd2b-531d-4824-8575-b1c527d29538',
        'info_dict': {
            'id': '35d3dd2b-531d-4824-8575-b1c527d29538',
            'title': 'レシピ集',
        },