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

Code before:
from .common import InfoExtractor
from ..utils import ExtractorError, clean_html, merge_dicts, parse_iso8601
from ..utils.traversal import traverse_obj


class AsobiChannelBaseIE(InfoExtractor):
    _MICROCMS_HEADER = {'X-MICROCMS-API-KEY': 'qRaKehul9AHU8KtL0dnq1OCLKnFec6yrbcz3'}

    def _extract_info(self, metadata):
        return traverse_obj(metadata, {
            'id': 'id',
            'title': 'title',
            'description': ('body', {clean_html}),
            'thumbnail': ('contents', 'video_thumb', 'url'),
            'timestamp': ('publishedAt', {parse_iso8601}),
            'modified_timestamp': ('updatedAt', {parse_iso8601}),
            'channel': ('channel', 'name'),
            'channel_id': ('channel', 'id'),
        })


class AsobiChannelIE(AsobiChannelBaseIE):
    IE_NAME = 'asobichannel'
    IE_DESC = 'ASOBI CHANNEL'

    _VALID_URL = r'https?://asobichannel\.asobistore\.jp/watch/(?P<id>[a-z0-9-_]+)'
    _TESTS = [{
        'url': 'https://asobichannel.asobistore.jp/watch/1ypp48qd32p',
        'md5': '39df74e872afe032c4eb27b89144fc92',
        'info_dict': {
            'id': '1ypp48qd32p',
            'ext': 'mp4',
            'title': 'アイドルマスター ミリオンライブ！ 765プロch 原っぱ通信 #1',
            'description': 'md5:b930bd2199c9b2fd75951ce4aaa7efd2',
            'thumbnail': 'https://images.microcms-assets.io/assets/d2420de4b9194e11beb164f99edb1f95/a8e6f84119f54eb9ab4ce16729239905/%E3%82%B5%E3%83%A0%E3%83%8D%20(1).png',
            'timestamp': 1697098247,
            'upload_date': '20231012',
            'modified_timestamp': 1698381162,
            'modified_date': '20231027',
            'channel': 'アイドルマスター',
            'channel_id': 'idolmaster',
        },
    }, {
        'url': 'https://asobichannel.asobistore.jp/watch/redigiwnjzqj',
        'md5': '229fa8fb5c591c75ce8c37a497f113f6',
        'info_dict': {
            'id': 'redigiwnjzqj',
            'ext': 'mp4',
            'title': '【おまけ放送】アイドルマスター ミリオンライブ！ 765プロch 原っぱ通信 #1',
            'description': 'md5:7d9cd35fb54425a6967822bd564ea2d9',
            'thumbnail': 'https://images.microcms-assets.io/assets/d2420de4b9194e11beb164f99edb1f95/20e5c1d6184242eebc2512a5dec59bf0/P1_%E5%8E%9F%E3%81%A3%E3%81%B1%E3%82%B5%E3%83%A0%E3%83%8D.png',

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://asobichannel\.asobistore\.jp/watch/(?P<id>[\w-]+)'
```

Code after:
from .common import InfoExtractor
from ..utils import (
    ExtractorError,
    clean_html,
    merge_dicts,
    parse_iso8601,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class AsobiChannelBaseIE(InfoExtractor):
    _MICROCMS_HEADER = {'X-MICROCMS-API-KEY': 'qRaKehul9AHU8KtL0dnq1OCLKnFec6yrbcz3'}

    def _extract_info(self, metadata):
        return traverse_obj(metadata, {
            'id': ('id', {str}),
            'title': ('title', {str}),
            'description': ('body', {clean_html}),
            'thumbnail': ('contents', 'video_thumb', 'url', {url_or_none}),
            'timestamp': ('publishedAt', {parse_iso8601}),
            'modified_timestamp': ('updatedAt', {parse_iso8601}),
            'channel': ('channel', 'name', {str}),
            'channel_id': ('channel', 'id', {str}),
        })


class AsobiChannelIE(AsobiChannelBaseIE):
    IE_NAME = 'asobichannel'
    IE_DESC = 'ASOBI CHANNEL'

    _VALID_URL = r'https?://asobichannel\.asobistore\.jp/watch/(?P<id>[\w-]+)'
    _TESTS = [{
        'url': 'https://asobichannel.asobistore.jp/watch/1ypp48qd32p',
        'md5': '39df74e872afe032c4eb27b89144fc92',
        'info_dict': {
            'id': '1ypp48qd32p',
            'ext': 'mp4',
            'title': 'アイドルマスター ミリオンライブ！ 765プロch 原っぱ通信 #1',
            'description': 'md5:b930bd2199c9b2fd75951ce4aaa7efd2',
            'thumbnail': 'https://images.microcms-assets.io/assets/d2420de4b9194e11beb164f99edb1f95/a8e6f84119f54eb9ab4ce16729239905/%E3%82%B5%E3%83%A0%E3%83%8D%20(1).png',
            'timestamp': 1697098247,
            'upload_date': '20231012',
            'modified_timestamp': 1698381162,
            'modified_date': '20231027',
            'channel': 'アイドルマスター',
            'channel_id': 'idolmaster',
        },
    }, {
        'url': 'https://asobichannel.asobistore.jp/watch/redigiwnjzqj',
        'md5': '229fa8fb5c591c75ce8c37a497f113f6',