ytdl-org/youtube-dl · error · ExtractorError

Invalid url %s

Error message

Invalid url %s

What it means

Raised by the Audiomack extractor when the song API response lacks a truthy 'url' key or contains an 'error' key — the comment notes the API is 'inconsistent with errors'. It guards against both explicit API error objects and silent failures where no stream URL is returned.

Source

Thrown at youtube_dl/extractor/audiomack.py:62

            # }
        },
    ]

    def _real_extract(self, url):
        # URLs end with [uploader name]/song/[uploader title]
        # this title is whatever the user types in, and is rarely
        # the proper song title.  Real metadata is in the api response
        album_url_tag = self._match_id(url).replace('/song/', '/')

        # Request the extended version of the api for extra fields like artist and title
        api_response = self._download_json(
            'http://www.audiomack.com/api/music/url/song/%s?extended=1&_=%d' % (
                album_url_tag, time.time()),
            album_url_tag)

        # API is inconsistent with errors
        if 'url' not in api_response or not api_response['url'] or 'error' in api_response:
            raise ExtractorError('Invalid url %s' % url)

        # Audiomack wraps a lot of soundcloud tracks in their branded wrapper
        # if so, pass the work off to the soundcloud extractor
        if SoundcloudIE.suitable(api_response['url']):
            return self.url_result(api_response['url'], SoundcloudIE.ie_key())

        return {
            'id': compat_str(api_response.get('id', album_url_tag)),
            'uploader': api_response.get('artist'),
            'title': api_response.get('title'),
            'url': api_response['url'],
        }


class AudiomackAlbumIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?audiomack\.com/(?:album/|(?=.+/album/))(?P<id>[\w/-]+)'
    IE_NAME = 'audiomack:album'
    _TESTS = [

View on GitHub (pinned to 956b8c5855)

Solutions

  1. Open the Audiomack page in a browser to confirm the track still exists
  2. Ensure the URL slug is exactly as shown on the site (typos produce silent nulls)
  3. If all Audiomack URLs fail, the legacy API is likely dead — upgrade to yt-dlp which uses the current API
  4. For wrapped Soundcloud tracks, using the Soundcloud URL directly can bypass Audiomack

Example fix

# before (old youtube-dl with legacy API)
youtube-dl 'http://www.audiomack.com/song/some-artist/removed-track'

# after
yt-dlp 'https://audiomack.com/some-artist/song/removed-track'  # current API implementation
Defensive patterns

Strategy: validation

Validate before calling

# Pre-check the legacy Audiomack API the same way the extractor does
import requests
api = requests.get('http://www.audiomack.com/api/music/url/song/%s' % tag,
                   params={'extended': 1}).json()
if not api.get('url') or 'error' in api:
    skip(url, reason=api.get('error', 'no stream url returned'))

Type guard

def is_audiomack_response_playable(api_response):
    """Audiomack API response is playable only with a truthy 'url' and no 'error' key."""
    return isinstance(api_response, dict) and bool(api_response.get('url')) and 'error' not in api_response

Try / catch

try:
    ydl.extract_info(url)
except ExtractorError as e:
    if 'Invalid url' in str(e):
        mark_url_dead(url)  # track removed or API rejected the slug; occasionally a takedown

Prevention

When it happens

Trigger: GET http://www.audiomack.com/api/music/url/song/<tag>?extended=1 returns {'url': null} or includes 'error'; song/album removed; slug typo after the /song/ → album normalization; API endpoint deprecated or redirecting.

Common situations: Dead Audiomack links; track taken down for copyright; API moved after site updates (this http:// endpoint is fragile in old youtube-dl); wrong url_tag from an unusual URL shape.

Related errors


AI-assisted analysis of ytdl-org/youtube-dl@956b8c5855 (2026-08-14). Data as JSON: /api/errors/7c6b2beb5543895b. Report an issue: GitHub.