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

Code before:
import re

from .common import InfoExtractor


class MixlrIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?(?P<username>[\w-]+)\.mixlr\.com/events/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://suncity-104-9fm.mixlr.com/events/4261962',
        'info_dict': {
            'id': '4261962',
            'title': re.compile(r'.+'),
            'description': re.compile(r'.+'),
            'ext': 'mp3',
            'is_live': True,
            'uploader': 'suncity-104-9fm',
        },
        'skip': 'Live broadcast may not be available',
    }]

    def _real_extract(self, url):
        mobj = self._match_valid_url(url)
        username = mobj.group('username')
        event_id = mobj.group('id')

        api_url = f'https://apicdn.mixlr.com/v3/channel_view/{username}'
        channel_info = self._download_json(api_url, event_id)
        user_data = channel_info.get('data', {}).get('attributes', {})

Review comment (refactor):
```suggestion
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, parse_iso8601, url_or_none, urlhandle_detect_ext
from ..utils.traversal import traverse_obj
```

Code after:
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, parse_iso8601, url_or_none, urlhandle_detect_ext
from ..utils.traversal import traverse_obj


class MixlrIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?(?P<username>[\w-]+)\.mixlr\.com/events/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://suncity-104-9fm.mixlr.com/events/4387115',
        'info_dict': {
            'id': '4387115',
            'ext': 'mp3',
            'title': r're:SUNCITY 104.9FM\'s live audio \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
            'uploader': 'suncity-104-9fm',
            'like_count': int,
            'thumbnail': r're:https://imagecdn\.mixlr\.com/cdn-cgi/image/[^/?#]+/cd5b34d05fa2cee72d80477724a2f02e.png',
            'timestamp': 1751943773,
            'upload_date': '20250708',
            'release_timestamp': 1751943764,
            'release_date': '20250708',
            'live_status': 'is_live',
        },
    }, {
        'url': 'https://brcountdown.mixlr.com/events/4395480',
        'info_dict': {
            'id': '4395480',
            'ext': 'aac',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/sauceplus.py (Python)

Code before:
from .floatplane import FloatplaneBaseIE


class SauceplusIE(FloatplaneBaseIE):
    _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
    _BASE_URL = 'https://www.sauceplus.com'
    _HEADERS = {'Origin': _BASE_URL,
                'Referer': _BASE_URL + '/'}
    _TESTS = [{
        'url': 'https://www.sauceplus.com/post/YbBwIa2A5g',
        'info_dict': {
            'id': 'eit4Ugu5TL',
            'ext': 'mp4',
            'display_id': 'YbBwIa2A5g',
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
            'availability': 'subscriber_only',
        },
        'params': {'skip_download': 'm3u8'},
    }]


Review comment (suggestion):
are `_HEADERS` used anywhere?
```suggestion
    _IMPERSONATE_TARGET = True
    _TESTS = [{
```

Code after:
from .floatplane import FloatplaneBaseIE


class SaucePlusIE(FloatplaneBaseIE):
    IE_DESC = 'Sauce+'
    _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
    _BASE_URL = 'https://www.sauceplus.com'
    _HEADERS = {
        'Origin': _BASE_URL,
        'Referer': f'{_BASE_URL}/',
    }
    _IMPERSONATE_TARGET = True
    _TESTS = [{
        'url': 'https://www.sauceplus.com/post/YbBwIa2A5g',
        'info_dict': {
            'id': 'eit4Ugu5TL',
            'ext': 'mp4',
            'display_id': 'YbBwIa2A5g',
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
            'availability': 'subscriber_only',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/sauceplus.py (Python)

Code before:
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
            'availability': 'subscriber_only',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_initialize(self):
        if not self._get_cookies(self._BASE_URL).get('__Host-sp-sess'):
            self.raise_login_required()

    def _real_extract(self, url):
        return self._base_extract(url, self._BASE_URL, do_impersonate=True)


Review comment (suggestion):
```suggestion
            self.raise_login_required()
```

Code after:
        'info_dict': {
            'id': 'eit4Ugu5TL',
            'ext': 'mp4',
            'display_id': 'YbBwIa2A5g',
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
            'availability': 'subscriber_only',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_initialize(self):
        if not self._get_cookies(self._BASE_URL).get('__Host-sp-sess'):
            self.raise_login_required()
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/sauceplus.py (Python)

Code before:
from .floatplane import FloatplaneBaseIE


class SauceplusIE(FloatplaneBaseIE):
    _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
    _BASE_URL = 'https://www.sauceplus.com'
    _HEADERS = {'Origin': _BASE_URL,
                'Referer': _BASE_URL + '/'}
    _IMPERSONATE_TARGET = 'chrome'  # Doesn't need to be chrome specifically
    _TESTS = [{
        'url': 'https://www.sauceplus.com/post/YbBwIa2A5g',
        'info_dict': {
            'id': 'eit4Ugu5TL',
            'ext': 'mp4',
            'display_id': 'YbBwIa2A5g',
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
            'availability': 'subscriber_only',
        },
        'params': {'skip_download': 'm3u8'},

Review comment (suggestion):
formatting
```suggestion
    _HEADERS = {
        'Origin': _BASE_URL,
        'Referer': f'{_BASE_URL}/',
    }
```

Code after:
from .floatplane import FloatplaneBaseIE


class SaucePlusIE(FloatplaneBaseIE):
    IE_DESC = 'Sauce+'
    _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
    _BASE_URL = 'https://www.sauceplus.com'
    _HEADERS = {
        'Origin': _BASE_URL,
        'Referer': f'{_BASE_URL}/',
    }
    _IMPERSONATE_TARGET = True
    _TESTS = [{
        'url': 'https://www.sauceplus.com/post/YbBwIa2A5g',
        'info_dict': {
            'id': 'eit4Ugu5TL',
            'ext': 'mp4',
            'display_id': 'YbBwIa2A5g',
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/sauceplus.py (Python)

Code before:
from .floatplane import FloatplaneBaseIE


class SauceplusIE(FloatplaneBaseIE):
    _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
    _BASE_URL = 'https://www.sauceplus.com'
    _HEADERS = {'Origin': _BASE_URL,
                'Referer': _BASE_URL + '/'}
    _IMPERSONATE_TARGET = 'chrome'  # Doesn't need to be chrome specifically
    _TESTS = [{
        'url': 'https://www.sauceplus.com/post/YbBwIa2A5g',
        'info_dict': {
            'id': 'eit4Ugu5TL',
            'ext': 'mp4',
            'display_id': 'YbBwIa2A5g',
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
            'availability': 'subscriber_only',
        },
        'params': {'skip_download': 'm3u8'},
    }]

Review comment (suggestion):
if we don't need `'chrome'` we can just use `True`
```suggestion
    _IMPERSONATE_TARGET = True
```

Code after:
from .floatplane import FloatplaneBaseIE


class SaucePlusIE(FloatplaneBaseIE):
    IE_DESC = 'Sauce+'
    _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
    _BASE_URL = 'https://www.sauceplus.com'
    _HEADERS = {
        'Origin': _BASE_URL,
        'Referer': f'{_BASE_URL}/',
    }
    _IMPERSONATE_TARGET = True
    _TESTS = [{
        'url': 'https://www.sauceplus.com/post/YbBwIa2A5g',
        'info_dict': {
            'id': 'eit4Ugu5TL',
            'ext': 'mp4',
            'display_id': 'YbBwIa2A5g',
            'title': 'Scare the Coyote - Episode 3',
            'description': '',
            'thumbnail': r're:^https?://.*\.jpe?g$',
            'duration': 2975,
            'comment_count': int,
            'like_count': int,
            'dislike_count': int,
            'release_date': '20250627',
            'release_timestamp': 1750993500,
            'uploader': 'Scare The Coyote',
            'uploader_id': '683e0a3269688656a5a49a44',
            'uploader_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home',
            'channel': 'Scare The Coyote',
            'channel_id': '683e0a326968866ceba49a45',
            'channel_url': 'https://www.sauceplus.com/channel/ScareTheCoyote/home/main',
            'availability': 'subscriber_only',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/_extractors.py (Python)

Code before:
    RutubeEmbedIE,
    RutubeIE,
    RutubeMovieIE,
    RutubePersonIE,
    RutubePlaylistIE,
    RutubeTagsIE,
)
from .rutv import RUTVIE
from .ruutu import RuutuIE
from .ruv import (
    RuvIE,
    RuvSpilaIE,
)
from .s4c import (
    S4CIE,
    S4CSeriesIE,
)
from .safari import (
    SafariApiIE,
    SafariCourseIE,
    SafariIE,
)
from .saitosan import SaitosanIE
from .samplefocus import SampleFocusIE
from .sapo import SapoIE
from .sauceplus import SauceplusIE
from .sbs import SBSIE
from .sbscokr import (
    SBSCoKrAllvodProgramIE,
    SBSCoKrIE,
    SBSCoKrProgramsVodIE,
)
from .screen9 import Screen9IE
from .screencast import ScreencastIE
from .screencastify import ScreencastifyIE
from .screencastomatic import ScreencastOMaticIE
from .screenrec import ScreenRecIE
from .scrippsnetworks import (
    ScrippsNetworksIE,
    ScrippsNetworksWatchIE,
)
from .scrolller import ScrolllerIE
from .scte import (
    SCTEIE,
    SCTECourseIE,
)
from .sejmpl import SejmIE
from .sen import SenIE
from .senalcolombia import SenalColombiaLiveIE
from .senategov import (
    SenateGovIE,

Review comment (suggestion):
```suggestion
from .sauceplus import SaucePlusIE
```

Code after:
    RutubeEmbedIE,
    RutubeIE,
    RutubeMovieIE,
    RutubePersonIE,
    RutubePlaylistIE,
    RutubeTagsIE,
)
from .rutv import RUTVIE
from .ruutu import RuutuIE
from .ruv import (
    RuvIE,
    RuvSpilaIE,
)
from .s4c import (
    S4CIE,
    S4CSeriesIE,
)
from .safari import (
    SafariApiIE,
    SafariCourseIE,
    SafariIE,
)
from .saitosan import SaitosanIE
from .samplefocus import SampleFocusIE
from .sapo import SapoIE
from .sauceplus import SaucePlusIE
from .sbs import SBSIE
from .sbscokr import (
    SBSCoKrAllvodProgramIE,
    SBSCoKrIE,
    SBSCoKrProgramsVodIE,
)
from .screen9 import Screen9IE
from .screencast import ScreencastIE
from .screencastify import ScreencastifyIE
from .screencastomatic import ScreencastOMaticIE
from .screenrec import ScreenRecIE
from .scrippsnetworks import (
    ScrippsNetworksIE,
    ScrippsNetworksWatchIE,
)
from .scrolller import ScrolllerIE
from .scte import (
    SCTEIE,
    SCTECourseIE,
)
from .sejmpl import SejmIE
from .sen import SenIE
from .senalcolombia import SenalColombiaLiveIE
from .senategov import (
    SenateGovIE,
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/skeb.py (Python)

Code before:
from .common import InfoExtractor
from ..utils import (
    clean_html,
    int_or_none,
    str_or_none,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class SkebIE(InfoExtractor):
    _VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[^/]+)/works/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://skeb.jp/@riiru_wm/works/10',
        'info_dict': {
            'id': '466853',
            'ext': 'mp4',
            'title': '10',
            'description': 'md5:1ec50901efc3437cfbfe3790468d532d',
            'display_id': '10',
            'duration': 313,
            'genres': ['video'],
            'thumbnail': r're:https?://.+',
            'uploader': '姫ノ森りぃる@ひとづま',
            'uploader_id': 'riiru_wm',
        },
    }, {
        'url': 'https://skeb.jp/@furukawa_nob/works/3',
        'info_dict': {
            'id': '489408',
            'ext': 'mp3',
            'title': '3',
            'description': 'md5:6de1f8f876426a6ac321c123848176a8',
            'display_id': '3',
            'duration': 98,
            'genres': ['voice'],
            'tags': 'count:11',

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[^/?#]+)/works/(?P<id>\d+)'
```

Code after:
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
    ExtractorError,
    clean_html,
    int_or_none,
    str_or_none,
    url_or_none,
)
from ..utils.traversal import traverse_obj


class SkebIE(InfoExtractor):
    _VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[^/?#]+)/works/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://skeb.jp/@riiru_wm/works/10',
        'info_dict': {
            'id': '466853',
            'ext': 'mp4',
            'title': '10-1',
            'description': 'md5:1ec50901efc3437cfbfe3790468d532d',
            'duration': 313,
            'genres': ['video'],
            'thumbnail': r're:https?://.+',
            'uploader': '姫ノ森りぃる@ひとづま',
            'uploader_id': 'riiru_wm',
        },
    }, {
        'url': 'https://skeb.jp/@furukawa_nob/works/3',
        'info_dict': {
            'id': '489408',
            'ext': 'mp3',
            'title': '3-1',
            'description': 'md5:6de1f8f876426a6ac321c123848176a8',
            'duration': 98,
            'genres': ['voice'],
            'tags': 'count:11',
Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/tenplay.py (Python)

Code before:
import itertools

from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, traverse_obj, url_or_none, urljoin


class TenPlayIE(InfoExtractor):
    IE_NAME = '10play'
    _VALID_URL = r'https?://(?:www\.)?10(play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
    _NETRC_MACHINE = '10play'
    _TESTS = [{
        # Geo-restricted to Australia
        'url': 'https://10play.com.au/australian-survivor/web-extras/season-10-brains-v-brawn-ii/myless-journey/tpv250414jdmtf',
        'info_dict': {
            'id': '7440980000013868',
            'ext': 'mp4',
            'title': 'Myles\'s Journey',
            'alt_title': 'Myles\'s Journey',
            'description': 'Relive Myles\'s epic Brains V Brawn II journey to reach the game\'s final two',
            'uploader': 'Channel 10',
            'uploader_id': '2199827728001',
            'age_limit': 15,
            'duration': 249,
            'thumbnail': r're:https://.+/.+\.jpg',
            'series': 'Australian Survivor',
            'season': 'Season 10',
            'season_number': 10,
            'timestamp': 1744629420,
            'upload_date': '20250414',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        # Geo-restricted to Australia
        'url': 'https://10play.com.au/neighbours/episodes/season-42/episode-9107/tpv240902nzqyp',

Review comment (suggestion):
all groups in a `_VALID_URL` pattern must be either named or non-capturing
```suggestion
    _VALID_URL = r'https?://(?:www\.)?10(?:play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
```

Code after:
import itertools

from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, traverse_obj, url_or_none, urljoin


class TenPlayIE(InfoExtractor):
    IE_NAME = '10play'
    _VALID_URL = r'https?://(?:www\.)?10(?:play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
    _NETRC_MACHINE = '10play'
    _TESTS = [{
        # Geo-restricted to Australia
        'url': 'https://10.com.au/australian-survivor/web-extras/season-10-brains-v-brawn-ii/myless-journey/tpv250414jdmtf',
        'info_dict': {
            'id': '7440980000013868',
            'ext': 'mp4',
            'title': 'Myles\'s Journey',
            'alt_title': 'Myles\'s Journey',
            'description': 'Relive Myles\'s epic Brains V Brawn II journey to reach the game\'s final two',
            'uploader': 'Channel 10',
            'uploader_id': '2199827728001',
            'age_limit': 15,
            'duration': 249,
            'thumbnail': r're:https://.+/.+\.jpg',
            'series': 'Australian Survivor',
            'season': 'Season 10',
            'season_number': 10,
            'timestamp': 1744629420,
            'upload_date': '20250414',
        },
        'params': {'skip_download': 'm3u8'},
    }, {
        # Geo-restricted to Australia
        'url': 'https://10.com.au/neighbours/episodes/season-42/episode-9107/tpv240902nzqyp',