{"record":{"id":"1d1cb3412c8277b6","repo":"ytdl-org/youtube-dl","slug":"did-you-forget-to-quote-the-url-remember-that-i","errorCode":null,"errorMessage":"Did you forget to quote the URL? Remember that & is a meta character in most shells, so you want to put the URL in quotes, like  youtube-dl \"https://www.youtube.com/watch?feature=foo&v=BaW_jenozKc\"  or simply  youtube-dl BaW_jenozKc  .","messagePattern":"Did you forget to quote the URL\\? Remember that & is a meta character in most shells, so you want to put the URL in quotes, like  youtube-dl \"https://www\\.youtube\\.com/watch\\?feature=foo&v=BaW_jenozKc\"  or simply  youtube-dl BaW_jenozKc  \\.","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/youtube.py","lineNumber":4474,"sourceCode":"    }, {\n        'url': 'https://www.youtube.com/watch?',\n        'only_matching': True,\n    }, {\n        'url': 'https://www.youtube.com/watch?x-yt-cl=84503534',\n        'only_matching': True,\n    }, {\n        'url': 'https://www.youtube.com/watch?feature=foo',\n        'only_matching': True,\n    }, {\n        'url': 'https://www.youtube.com/watch?hl=en-GB',\n        'only_matching': True,\n    }, {\n        'url': 'https://www.youtube.com/watch?t=2372',\n        'only_matching': True,\n    }]\n\n    def _real_extract(self, _):\n        raise ExtractorError(\n            'Did you forget to quote the URL? Remember that & is a meta '\n            'character in most shells, so you want to put the URL in quotes, '\n            'like  youtube-dl '\n            '\"https://www.youtube.com/watch?feature=foo&v=BaW_jenozKc\" '\n            ' or simply  youtube-dl BaW_jenozKc  .',\n            expected=True)\n\n\nclass YoutubeTruncatedIDIE(InfoExtractor):\n    IE_NAME = 'youtube:truncated_id'\n    IE_DESC = False  # Do not list\n    _VALID_URL = r'https?://(?:www\\.)?youtube\\.com/watch\\?v=(?P<id>[0-9A-Za-z_-]{1,10})$'\n\n    _TESTS = [{\n        'url': 'https://www.youtube.com/watch?v=N_708QY7Ob',\n        'only_matching': True,\n    }]\n","sourceCodeStart":4456,"sourceCodeEnd":4492,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/youtube.py#L4456-L4492","documentation":"Raised by YoutubeTruncatedURLIE._real_extract, a stub extractor that matches youtube.com/watch URLs missing the video id (e.g. only ?feature=foo or ?t=2372 remains). Its sole purpose is to produce a helpful, expected=True message telling the user the URL was cut — almost always because an unquoted '&' in the shell terminated the query string. No extraction is attempted.","triggerScenarios":"Running youtube-dl https://www.youtube.com/watch?feature=foo&v=BaW_jenozKc without quotes: the shell runs the part before & as the command, so youtube-dl receives https://www.youtube.com/watch?feature=foo, which matches the truncated-URL IE and triggers this message.","commonSituations":"Unquoted URLs in bash/zsh (most common); scripts building URLs with word-splitting; copied URLs truncated at the first &; also matches watch?hl=... or watch?t=... alone per the only_matching tests.","solutions":["Quote the URL: youtube-dl \"https://www.youtube.com/watch?feature=foo&v=BaW_jenozKc\".","Or shorten to the bare id: youtube-dl BaW_jenozKc.","In scripts, always pass URLs as properly quoted single arguments (list argv, not string interpolation subject to word splitting)."],"exampleFix":"# before\nyoutube-dl https://www.youtube.com/watch?feature=foo&v=BaW_jenozKc\n\n# after\nyoutube-dl \"https://www.youtube.com/watch?feature=foo&v=BaW_jenozKc\"\n# or\nyoutube-dl BaW_jenozKc","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse, parse_qs\n\ndef url_has_video_id(url: str) -> bool:\n    return bool(parse_qs(urlparse(url).query).get('v')) or re.fullmatch(r'[0-9A-Za-z_-]{11}', url) is not None","typeGuard":null,"tryCatchPattern":"try:\n    info = ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'Did you forget to quote the URL?' in str(e):\n        url = shell_quote(url)  # fix argv construction and retry\n        info = ydl.extract_info(url)\n    else:\n        raise","preventionTips":["Quote every URL containing & at the shell prompt.","In scripts, pass URLs as single argv elements; never let word splitting touch query strings."],"tags":["youtube","shell-quoting","truncated-url","usage-error"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}