{"record":{"id":"2fc5ef2f79bd48d1","repo":"ytdl-org/youtube-dl","slug":"this-song-is-blocked-in-this-region","errorCode":null,"errorMessage":"This song is blocked in this region","messagePattern":"This song is blocked in this region","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/kuwo.py","lineNumber":45,"sourceCode":"    def _get_formats(self, song_id, tolerate_ip_deny=False):\n        formats = []\n        for file_format in self._FORMATS:\n            query = {\n                'format': file_format['ext'],\n                'br': file_format.get('br', ''),\n                'rid': 'MUSIC_%s' % song_id,\n                'type': 'convert_url',\n                'response': 'url'\n            }\n\n            song_url = self._download_webpage(\n                'http://antiserver.kuwo.cn/anti.s',\n                song_id, note='Download %s url info' % file_format['format'],\n                query=query, headers=self.geo_verification_headers(),\n            )\n\n            if song_url == 'IPDeny' and not tolerate_ip_deny:\n                raise ExtractorError('This song is blocked in this region', expected=True)\n\n            if song_url.startswith('http://') or song_url.startswith('https://'):\n                formats.append({\n                    'url': song_url,\n                    'format_id': file_format['format'],\n                    'format': file_format['format'],\n                    'preference': file_format['preference'],\n                    'abr': file_format.get('abr'),\n                })\n\n        return formats\n\n\nclass KuwoIE(KuwoBaseIE):\n    IE_NAME = 'kuwo:song'\n    IE_DESC = '酷我音乐'\n    _VALID_URL = r'https?://(?:www\\.)?kuwo\\.cn/yinyue/(?P<id>\\d+)'\n    _TESTS = [{","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/kuwo.py#L27-L63","documentation":"Raised by the Kuwo extractor when the antiserver.kuwo.cn/anti.s URL-resolution endpoint replies with the literal string 'IPDeny' instead of a media URL, meaning the song's CDN refuses the requester's IP region. It is expected=True and geo-related; Kuwo enforces regional licensing on a per-song basis.","triggerScenarios":"Calling the Kuwo song (or MV) extractor from an IP outside the licensed region for that song: the convert_url request with query rid=MUSIC_<song_id>&response=url returns exactly 'IPDeny'. Only raised when tolerate_ip_deny is False (the plain song extractor); the MV extractor tolerates it and proceeds without those formats.","commonSituations":"Running youtube-dl on kuwo.cn songs from outside mainland China; VPN exit nodes in unlicensed regions; songs licensed only regionally (many Mandopop catalog items); CI runners hosted abroad hitting geo-fenced tracks.","solutions":["Route traffic through a mainland-China (or otherwise licensed-region) proxy/VPN and retry","Use a different source for the song (other licensed platform or region-free mirror)","Pick a different quality/format that is not geo-fenced, by inspecting which format request returned IPDeny","If you only need metadata/lyrics, fetch the song page directly instead of downloading audio"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept ExtractorError as e:\n    if 'blocked in this region' in str(e):\n        retry_through_regional_proxy(url)  # or fall back to another source\n    else:\n        raise","preventionTips":["Send downloads of Chinese music platforms through a mainland-China egress","In custom code, call KuwoIE._get_formats(song_id, tolerate_ip_deny=True) to skip geo-denied formats instead of failing"],"tags":["kuwo","geo-restriction","extractor","music"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}