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

Code before:
class AudiodraftIE(InfoExtractor):
    def _audiodraft_extract_from_id(self, player_entry_id):
        data_json = self._download_json(
            'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', player_entry_id,
            headers={
                'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
                'X-Requested-With': 'XMLHttpRequest',
            }, data=f'id={player_entry_id}'.encode('utf-8'))

        return {
            'id': str(data_json['entry_id']),
            'title': data_json.get('entry_title'),
            'url': data_json['path'],
            'vcodec': 'none',
            'ext': 'mp3',
            'uploader': data_json.get('designer_name'),
            'uploader_id': data_json.get('designer_id'),
            'webpage_url': data_json.get('entry_url'),
            'like_count': int_or_none(data_json.get('entry_likes')),
            'average_rating': int_or_none(data_json.get('entry_rating')),
        }


class AudiodraftCustomIE(AudiodraftIE):
    IE_NAME = 'Audiodraft:custom'
    _VALID_URL = r'https?://(?:[A-Za-z0-9\-]+)\.audiodraft\.com/entry/(?P<id>\d+)'

    _TESTS = [{
        'url': 'http://nokiatune.audiodraft.com/entry/5874',
        'info_dict': {
            'id': '9485',
            'ext': 'mp3',
            'title': 'Hula Hula Calls',
            'uploader': 'unclemaki',
            'uploader_id': '13512',
            'average_rating': 5,
            'like_count': int,
        },
    }, {
        'url': 'http://vikinggrace.audiodraft.com/entry/501',
        'info_dict': {
            'id': '22241',
            'ext': 'mp3',
            'title': 'MVG Happy',
            'uploader': 'frog',
            'uploader_id': '19142',
            'average_rating': 5,
            'like_count': int,
        },
    }, {
        'url': 'http://timferriss.audiodraft.com/entry/765',

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://(?:[-\w]+)\.audiodraft\.com/entry/(?P<id>\d+)'
```

Code after:
class AudiodraftBaseIE(InfoExtractor):
    def _audiodraft_extract_from_id(self, player_entry_id):
        data_json = self._download_json(
            'https://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.php', player_entry_id,
            headers={
                'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
                'X-Requested-With': 'XMLHttpRequest',
            }, data=f'id={player_entry_id}'.encode('utf-8'))

        return {
            'id': str(data_json['entry_id']),
            'title': data_json.get('entry_title'),
            'url': data_json['path'],
            'vcodec': 'none',
            'ext': 'mp3',
            'uploader': data_json.get('designer_name'),
            'uploader_id': data_json.get('designer_id'),
            'webpage_url': data_json.get('entry_url'),
            'like_count': int_or_none(data_json.get('entry_likes')),
            'average_rating': int_or_none(data_json.get('entry_rating')),
        }


class AudiodraftCustomIE(AudiodraftBaseIE):
    IE_NAME = 'Audiodraft:custom'
    _VALID_URL = r'https?://(?:[-\w]+)\.audiodraft\.com/entry/(?P<id>\d+)'

    _TESTS = [{
        'url': 'http://nokiatune.audiodraft.com/entry/5874',
        'info_dict': {
            'id': '9485',
            'ext': 'mp3',
            'title': 'Hula Hula Calls',
            'uploader': 'unclemaki',
            'uploader_id': '13512',
            'average_rating': 5,
            'like_count': int,
        },
    }, {
        'url': 'http://vikinggrace.audiodraft.com/entry/501',
        'info_dict': {
            'id': '22241',
            'ext': 'mp3',
            'title': 'MVG Happy',
            'uploader': 'frog',
            'uploader_id': '19142',
            'average_rating': 5,
            'like_count': int,
        },
    }, {
        'url': 'http://timferriss.audiodraft.com/entry/765',