{"record":{"id":"ea1daeacedf1ffad","repo":"ytdl-org/youtube-dl","slug":"invalid-url-ea1dae","errorCode":null,"errorMessage":"Invalid URL","messagePattern":"Invalid URL","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/bokecc.py","lineNumber":50,"sourceCode":"\n\nclass BokeCCIE(BokeCCBaseIE):\n    IE_DESC = 'CC视频'\n    _VALID_URL = r'https?://union\\.bokecc\\.com/playvideo\\.bo\\?(?P<query>.*)'\n\n    _TESTS = [{\n        'url': 'http://union.bokecc.com/playvideo.bo?vid=E0ABAE9D4F509B189C33DC5901307461&uid=FE644790DE9D154A',\n        'info_dict': {\n            'id': 'FE644790DE9D154A_E0ABAE9D4F509B189C33DC5901307461',\n            'ext': 'flv',\n            'title': 'BokeCC Video',\n        },\n    }]\n\n    def _real_extract(self, url):\n        qs = compat_parse_qs(re.match(self._VALID_URL, url).group('query'))\n        if not qs.get('vid') or not qs.get('uid'):\n            raise ExtractorError('Invalid URL', expected=True)\n\n        video_id = '%s_%s' % (qs['uid'][0], qs['vid'][0])\n\n        webpage = self._download_webpage(url, video_id)\n\n        return {\n            'id': video_id,\n            'title': 'BokeCC Video',  # no title provided in the webpage\n            'formats': self._extract_bokecc_formats(webpage, video_id),\n        }\n","sourceCodeStart":32,"sourceCodeEnd":61,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/bokecc.py#L32-L61","documentation":"Raised by BokeCCIE._real_extract after matching the _VALID_URL: it re-parses the captured query string with compat_parse_qs and requires both 'vid' and 'uid' parameters to be present. If either is missing from the URL's query, it raises 'Invalid URL' (expected=True) before any network request is made. Note the URL must still have matched the extractor's regex, so this fires for URLs shaped right but lacking the required params.","triggerScenarios":"Passing a union.bokecc.com/playvideo.bo URL whose query string omits vid or uid, e.g. '?vid=...' alone, an empty '?', or params misspelled ('videoId' instead of 'vid'). The regex group 'query' captures whatever follows so parse_qs yields a dict without the required keys.","commonSituations":"Hand-copied URLs truncated at '?' or '&'; embedding templates that drop empty parameters; upstream pages generating bokecc links with only one param after API changes; URL-encoded ampersands splitting into a single malformed param.","solutions":["Fix the URL: ensure both query parameters are present, e.g. http://union.bokecc.com/playvideo.bo?vid=<video>&uid=<user>.","If you control link generation, never emit bokecc links missing either param.","Validate the query string with parse_qs yourself before handing the URL to the extractor.","Check for HTML-entity-encoded ampersands (&amp;) in copied URLs — decode them first."],"exampleFix":"// before - caller passes a URL missing uid\nYoutubeDL().extract_info('http://union.bokecc.com/playvideo.bo?vid=E0ABAE9D4F509B189C33DC5901307461')\n\n// after - validate required params first\nfrom urllib.parse import urlparse, parse_qs\nu = 'http://union.bokecc.com/playvideo.bo?vid=E0ABAE9D4F509B189C33DC5901307461'\nq = parse_qs(urlparse(u).query)\nif not (q.get('vid') and q.get('uid')):\n    raise SystemExit('bokecc URL must include both vid and uid')\nYoutubeDL().extract_info(u)","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse, parse_qs\n\ndef bokecc_url_is_valid(url):\n    q = parse_qs(urlparse(url).query)\n    return bool(q.get('vid')) and bool(q.get('uid'))","typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept ExtractorError as e:\n    if str(e) == 'Invalid URL':\n        raise ValueError('bokecc URL must include both vid and uid query params: %s' % url) from e\n    raise","preventionTips":["Always emit both vid and uid when constructing bokecc links.","Validate the query string with parse_qs before extraction; the error is fully deterministic.","HTML-decode copied URLs (&amp; -> &) before use."],"tags":["bokecc","invalid-url","query-params","validation","extractor"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}