ronantakizawa/codereview-bench huggingface dataset:
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/parlview.py (Python)

Code before:
    }, {
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
        'only_matching': True,
    }]
    _API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'

    def _real_extract(self, url):
        video_id = self._match_id(url)
        api_data = self._download_json(self._API_URL % video_id, video_id)

        video_details = traverse_obj(api_data, ('videoDetails', {dict}))
        if not video_details:
            raise ExtractorError('API request was not successful', expected=traverse_obj(api_data, ('wasSuccessful', {bool})) is False)

        m3u8_url = traverse_obj(video_details, ('files', 'file', 'url', {str}))
        formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native')

        return {
            'id': video_id,
            'formats': formats,
            'uploader': 'Australian Parliament House',
            ** traverse_obj(video_details, {
                'title': (('parlViewTitle', 'title'), {str}, any),
                'description': ('parlViewDescription', {str}),
                'duration': ('files', 'file', 'duration', {lambda s: ':'.join((s or '').split(':')[:3])}, {parse_duration}),
                'timestamp': ('recordingFrom', {unified_timestamp}),
                'thumbnail': ('thumbUrl', {url_or_none}),
                'series': (None, {lambda vd: join_nonempty('eventGroup', 'eventSubGroup', delim=' - ', from_dict=vd)}),
            }),
        }


Review comment (suggestion):
This is an iso timestamp
```suggestion
                'timestamp': ('recordingFrom', {parse_iso8601}),
```

Code after:
            'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/CommitteeThumbnail06.jpg',
            'upload_date': '19960822',
            'duration': 14765,
            'timestamp': 840754200,
        },
        'params': {
            'skip_download': True,
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        video_details = self._download_json(
            f'https://vodapi.aph.gov.au/api/search/parlview/{video_id}', video_id)['videoDetails']

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            video_details['files']['file']['url'], video_id, 'mp4')

        DURATION_RE = re.compile(r'(?P<duration>\d+:\d+:\d+):\d+')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(video_details, {
                'title': (('parlViewTitle', 'title'), {str}, any),
                'description': ('parlViewDescription', {str}),
                'duration': ('files', 'file', 'duration', {DURATION_RE.fullmatch}, 'duration', {parse_duration}),
                'timestamp': ('recordingFrom', {parse_iso8601}),
                'thumbnail': ('thumbUrl', {url_or_none}),
            }),
        }
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/parlview.py (Python)

Code before:
        'only_matching': True,
    }]
    _API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'

    def _real_extract(self, url):
        video_id = self._match_id(url)
        api_data = self._download_json(self._API_URL % video_id, video_id)

        video_details = traverse_obj(api_data, ('videoDetails', {dict}))
        if not video_details:
            raise ExtractorError('API request was not successful', expected=traverse_obj(api_data, ('wasSuccessful', {bool})) is False)

        m3u8_url = traverse_obj(video_details, ('files', 'file', 'url', {str}))
        formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native')

        return {
            'id': video_id,
            'formats': formats,
            'uploader': 'Australian Parliament House',
            ** traverse_obj(video_details, {
                'title': (('parlViewTitle', 'title'), {str}, any),
                'description': ('parlViewDescription', {str}),
                'duration': ('files', 'file', 'duration', {lambda s: ':'.join((s or '').split(':')[:3])}, {parse_duration}),
                'timestamp': ('recordingFrom', {unified_timestamp}),
                'thumbnail': ('thumbUrl', {url_or_none}),
                'series': (None, {lambda vd: join_nonempty('eventGroup', 'eventSubGroup', delim=' - ', from_dict=vd)}),
            }),
        }


Review comment (suggestion):
This is not really a series. I would just drop it
```suggestion
```

Code after:
            'duration': 14765,
            'timestamp': 840754200,
        },
        'params': {
            'skip_download': True,
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        video_details = self._download_json(
            f'https://vodapi.aph.gov.au/api/search/parlview/{video_id}', video_id)['videoDetails']

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            video_details['files']['file']['url'], video_id, 'mp4')

        DURATION_RE = re.compile(r'(?P<duration>\d+:\d+:\d+):\d+')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(video_details, {
                'title': (('parlViewTitle', 'title'), {str}, any),
                'description': ('parlViewDescription', {str}),
                'duration': ('files', 'file', 'duration', {DURATION_RE.fullmatch}, 'duration', {parse_duration}),
                'timestamp': ('recordingFrom', {parse_iso8601}),
                'thumbnail': ('thumbUrl', {url_or_none}),
            }),
        }
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/parlview.py (Python)

Code before:
import re

from yt_dlp.utils._utils import parse_iso8601

from .common import InfoExtractor
from ..utils import (
    parse_duration,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class ParlviewIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>[^/?#]+)'
    _TESTS = [{
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
        'info_dict': {
            'id': '3406614',
            'ext': 'mp4',
            'title': 'Senate Chamber',
            'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
            'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
            'upload_date': '20250325',
            'duration': 17999,
            'timestamp': 1742939400,
        },
        'params': {
            'skip_download': True,

Review comment (suggestion):
Please follow the import conventions
```suggestion
```

Code after:
import re

from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj


class ParlviewIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
    _TESTS = [{
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
        'info_dict': {
            'id': '3406614',
            'ext': 'mp4',
            'title': 'Senate Chamber',
            'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
            'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
            'upload_date': '20250325',
            'duration': 17999,
            'timestamp': 1742939400,
        },
        'params': {
            'skip_download': True,
        },
    }, {
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv',
        'info_dict': {
            'id': 'SV1394.dv',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/parlview.py (Python)

Code before:
import re

from yt_dlp.utils._utils import parse_iso8601

from .common import InfoExtractor
from ..utils import (
    parse_duration,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class ParlviewIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>[^/?#]+)'
    _TESTS = [{
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
        'info_dict': {
            'id': '3406614',
            'ext': 'mp4',
            'title': 'Senate Chamber',
            'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
            'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
            'upload_date': '20250325',
            'duration': 17999,
            'timestamp': 1742939400,
        },
        'params': {
            'skip_download': True,
        },
    }, {
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv',
        'info_dict': {

Review comment (suggestion):
```suggestion
    parse_duration,
    parse_iso8601,
```

Code after:
import re

from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj


class ParlviewIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
    _TESTS = [{
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
        'info_dict': {
            'id': '3406614',
            'ext': 'mp4',
            'title': 'Senate Chamber',
            'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
            'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
            'upload_date': '20250325',
            'duration': 17999,
            'timestamp': 1742939400,
        },
        'params': {
            'skip_download': True,
        },
    }, {
        'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv',
        'info_dict': {
            'id': 'SV1394.dv',
            'ext': 'mp4',
            'title': 'Senate Select Committee on Uranium Mining and Milling [Part 1]',
            'description': 'Official Recording of Senate Committee Proceedings from the Australian Parliament',
            'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/CommitteeThumbnail06.jpg',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/faulio.py (Python)

Code before:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import js_to_json, url_or_none
from ..utils.traversal import traverse_obj

_DOMAINS = (
    'aloula.sba.sa',
    'bahry.com',
    'maraya.sba.net.ae',
    'sat7plus.org',
)

_LANGUAGES = (
    'ar',
    'en',
    'fa',
)


class FaulioBase(InfoExtractor):
    def _get_headers(self, url):
        origin = f'{urllib.parse.urlparse(url).scheme}://{urllib.parse.urlparse(url).netloc}'
        return {
            'Referer': origin,
            'Origin': origin,
        }

    def _get_api_base(self, url, video_id):
        webpage = self._download_webpage(url, video_id)
        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBase):
    _VALID_URL = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(map(re.escape, _LANGUAGES))})/)?(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [

Review comment (suggestion):
move to baseclass
```suggestion
from ..utils.traversal import traverse_obj
```

Code after:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import int_or_none, js_to_json, url_or_none
from ..utils.traversal import traverse_obj


class FaulioBaseIE(InfoExtractor):
    _DOMAINS = (
        'aloula.sba.sa',
        'bahry.com',
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _LANGUAGES = ('ar', 'en', 'fa')
    _BASE_URL_RE = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(_LANGUAGES)})/)?'

    def _get_headers(self, url):
        parsed_url = urllib.parse.urlparse(url)
        return {
            'Referer': url,
            'Origin': f'{parsed_url.scheme}://{parsed_url.hostname}',
        }

    def _get_api_base(self, url, video_id):
        webpage = self._download_webpage(url, video_id)
        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBaseIE):
    _VALID_URL = fr'{FaulioBaseIE._BASE_URL_RE}(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [{
        'url': 'https://aloula.sba.sa/en/episode/29102',
        'info_dict': {
            'id': 'aloula.faulio.com_29102',
            'ext': 'mp4',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/faulio.py (Python)

Code before:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import js_to_json, url_or_none
from ..utils.traversal import traverse_obj

_DOMAINS = (
    'aloula.sba.sa',
    'bahry.com',
    'maraya.sba.net.ae',
    'sat7plus.org',
)

_LANGUAGES = (
    'ar',
    'en',
    'fa',
)


class FaulioBase(InfoExtractor):
    def _get_headers(self, url):
        origin = f'{urllib.parse.urlparse(url).scheme}://{urllib.parse.urlparse(url).netloc}'
        return {
            'Referer': origin,
            'Origin': origin,
        }

    def _get_api_base(self, url, video_id):
        webpage = self._download_webpage(url, video_id)
        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBase):
    _VALID_URL = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(map(re.escape, _LANGUAGES))})/)?(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [
        {
            'url': 'https://bahry.com/en/media/1191',
            'info_dict': {
                'id': 'bahry.faulio.com_1191',
                'ext': 'mp4',
                'display_id': 'Episode-4-1191',
                'title': 'Episode 4',
                'episode': 'Episode 4',

Review comment (refactor):
- move `_LANGUAGES` inside baseclass
- baseclass name must end in `IE`
```suggestion

class FaulioBaseIE(InfoExtractor):
```

Code after:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import int_or_none, js_to_json, url_or_none
from ..utils.traversal import traverse_obj


class FaulioBaseIE(InfoExtractor):
    _DOMAINS = (
        'aloula.sba.sa',
        'bahry.com',
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _LANGUAGES = ('ar', 'en', 'fa')
    _BASE_URL_RE = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(_LANGUAGES)})/)?'

    def _get_headers(self, url):
        parsed_url = urllib.parse.urlparse(url)
        return {
            'Referer': url,
            'Origin': f'{parsed_url.scheme}://{parsed_url.hostname}',
        }

    def _get_api_base(self, url, video_id):
        webpage = self._download_webpage(url, video_id)
        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBaseIE):
    _VALID_URL = fr'{FaulioBaseIE._BASE_URL_RE}(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [{
        'url': 'https://aloula.sba.sa/en/episode/29102',
        'info_dict': {
            'id': 'aloula.faulio.com_29102',
            'ext': 'mp4',
            'display_id': 'هذا-مكانك-03-004-v-29102',
            'title': 'الحلقة 4',
            'episode': 'الحلقة 4',
            'description': '',
            'series': 'هذا مكانك',
            'season': 'Season 3',
            'season_number': 3,
            'episode_number': 4,
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/faulio.py (Python)

Code before:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import js_to_json, url_or_none
from ..utils.traversal import traverse_obj

_DOMAINS = (
    'aloula.sba.sa',
    'bahry.com',
    'maraya.sba.net.ae',
    'sat7plus.org',
)

_LANGUAGES = (
    'ar',
    'en',
    'fa',
)


class FaulioBase(InfoExtractor):
    def _get_headers(self, url):
        origin = f'{urllib.parse.urlparse(url).scheme}://{urllib.parse.urlparse(url).netloc}'
        return {
            'Referer': origin,
            'Origin': origin,
        }

    def _get_api_base(self, url, video_id):
        webpage = self._download_webpage(url, video_id)
        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBase):
    _VALID_URL = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(map(re.escape, _LANGUAGES))})/)?(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [
        {
            'url': 'https://bahry.com/en/media/1191',
            'info_dict': {
                'id': 'bahry.faulio.com_1191',
                'ext': 'mp4',

Review comment (security):
```suggestion
    _DOMAINS = (
        'aloula.sba.sa',
        'bahry.com',
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _LANGUAGES = ('ar', 'en', 'fa')
    _BASE_URL_RE = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(_LANGUAGES)})/)?'

    def _get_headers(self, url):
```

Code after:
import re
import urllib.parse

from .common import InfoExtractor
from ..utils import int_or_none, js_to_json, url_or_none
from ..utils.traversal import traverse_obj


class FaulioBaseIE(InfoExtractor):
    _DOMAINS = (
        'aloula.sba.sa',
        'bahry.com',
        'maraya.sba.net.ae',
        'sat7plus.org',
    )
    _LANGUAGES = ('ar', 'en', 'fa')
    _BASE_URL_RE = fr'https?://(?:{"|".join(map(re.escape, _DOMAINS))})/(?:(?:{"|".join(_LANGUAGES)})/)?'

    def _get_headers(self, url):
        parsed_url = urllib.parse.urlparse(url)
        return {
            'Referer': url,
            'Origin': f'{parsed_url.scheme}://{parsed_url.hostname}',
        }

    def _get_api_base(self, url, video_id):
        webpage = self._download_webpage(url, video_id)
        config_data = self._search_json(
            r'window\.__NUXT__\.config=', webpage, 'config', video_id, transform_source=js_to_json)
        return config_data['public']['TRANSLATIONS_API_URL']


class FaulioIE(FaulioBaseIE):
    _VALID_URL = fr'{FaulioBaseIE._BASE_URL_RE}(?:episode|media)/(?P<id>[a-zA-Z0-9-]+)'
    _TESTS = [{
        'url': 'https://aloula.sba.sa/en/episode/29102',
        'info_dict': {
            'id': 'aloula.faulio.com_29102',
            'ext': 'mp4',
            'display_id': 'هذا-مكانك-03-004-v-29102',
            'title': 'الحلقة 4',
            'episode': 'الحلقة 4',
            'description': '',
            'series': 'هذا مكانك',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/adobetv.py (Python)

Code before:
from .common import InfoExtractor
from ..utils import (
    ISO639Utils,
    clean_html,
    determine_ext,
    float_or_none,
    int_or_none,
    join_nonempty,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class AdobeTVVideoIE(InfoExtractor):
    IE_NAME = 'adobe:tv'
    _VALID_URL = r'https?://video\.tv\.adobe\.com/v/(?P<id>[^/?#]+)'
    _EMBED_REGEX = [r'<iframe[^>]+src=[\'"](?P<url>(?:https?:)?//video\.tv\.adobe\.com/v/[^\'"]+)']
    _TESTS = [{
        'url': 'https://video.tv.adobe.com/v/2456',
        'md5': '43662b577c018ad707a63766462b1e87',
        'info_dict': {
            'id': '2456',
            'ext': 'mp4',
            'title': 'New experience with Acrobat DC',
            'description': 'New experience with Acrobat DC',
            'duration': 248.522,
            'thumbnail': r're:https?://images-tv\.adobe\.com/.+\.jpg',
        },
    }, {
        'url': 'https://video.tv.adobe.com/v/3463980/adobe-acrobat',
        'info_dict': {
            'id': '3463980',
            'ext': 'mp4',
            'title': 'Adobe Acrobat: How to Customize the Toolbar for Faster PDF Editing',
            'description': 'md5:94368ab95ae24f9c1bee0cb346e03dc3',
            'duration': 97.514,
            'thumbnail': r're:https?://images-tv\.adobe\.com/.+\.jpg',
        },
    }]
    _WEBPAGE_TESTS = [{
        # https://video.tv.adobe.com/v/3442499

Review comment (suggestion):
Unless you have an example URL where the ID isn't numeric, let's keep the pattern the same
```suggestion
    _VALID_URL = r'https?://video\.tv\.adobe\.com/v/(?P<id>\d+)'
```

Code after:
from .common import InfoExtractor
from ..utils import (
    ISO639Utils,
    clean_html,
    determine_ext,
    float_or_none,
    int_or_none,
    join_nonempty,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class AdobeTVVideoIE(InfoExtractor):
    IE_NAME = 'adobetv'
    _VALID_URL = r'https?://video\.tv\.adobe\.com/v/(?P<id>\d+)'
    _EMBED_REGEX = [r'<iframe[^>]+src=["\'](?P<url>(?:https?:)?//video\.tv\.adobe\.com/v/\d+)']
    _TESTS = [{
        'url': 'https://video.tv.adobe.com/v/2456',
        'md5': '43662b577c018ad707a63766462b1e87',
        'info_dict': {
            'id': '2456',
            'ext': 'mp4',
            'title': 'New experience with Acrobat DC',
            'description': 'New experience with Acrobat DC',
            'duration': 248.522,
            'thumbnail': r're:https?://images-tv\.adobe\.com/.+\.jpg',
        },
    }, {
        'url': 'https://video.tv.adobe.com/v/3463980/adobe-acrobat',
        'info_dict': {
            'id': '3463980',
            'ext': 'mp4',
            'title': 'Adobe Acrobat: How to Customize the Toolbar for Faster PDF Editing',
            'description': 'md5:94368ab95ae24f9c1bee0cb346e03dc3',
            'duration': 97.514,
            'thumbnail': r're:https?://images-tv\.adobe\.com/.+\.jpg',
        },
    }]
    _WEBPAGE_TESTS = [{
        # https://video.tv.adobe.com/v/3442499