{"record":{"id":"3e0b05815effa587","repo":"soimort/you-get","slug":"url-does-not-conform-to-specifications-support-qu","errorCode":null,"errorMessage":"URL does not conform to specifications, Support question only. Example URL: https://www.zhihu.com/question/267782048","messagePattern":"URL does not conform to specifications, Support question only\\. Example URL: https://www\\.zhihu\\.com/question/267782048","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/you_get/extractors/zhihu.py","lineNumber":52,"sourceCode":"        # second Standard Definition\n        # third Low Definition\n        # finally continue\n        data = play_list.get(\"hd\", play_list.get(\"sd\", play_list.get(\"ld\", None)))\n        if not data:\n            log.w(\"Video id No play address:{}\".format(video_id))\n            continue\n        print_info(site_info, title, data[\"format\"], data[\"size\"])\n        if not info_only:\n            ext = \"_{}.{}\".format(index, data[\"format\"])\n            if kwargs.get(\"zhihu_offset\"):\n                ext = \"_{}\".format(kwargs[\"zhihu_offset\"]) + ext\n            download_urls([data[\"play_url\"]], title, ext, data[\"size\"],\n                          output_dir=output_dir, merge=merge, **kwargs)\n\n\ndef zhihu_download_playlist(url, output_dir='.', merge=True, info_only=False, **kwargs):\n    if \"question\" not in url or \"answer\" in url:  # question page\n        raise TypeError(\"URL does not conform to specifications, Support question only.\"\n                        \" Example URL: https://www.zhihu.com/question/267782048\")\n    url = url.split(\"?\")[0]\n    if url[-1] == \"/\":\n        question_id = url.split(\"/\")[-2]\n    else:\n        question_id = url.split(\"/\")[-1]\n    videos_url = r\"https://www.zhihu.com/api/v4/questions/{}/answers\".format(question_id)\n    try:\n        questions = json.loads(get_content(videos_url))\n    except json.decoder.JSONDecodeError:\n        raise TypeError(\"Check whether the problem URL exists.Example URL: https://www.zhihu.com/question/267782048\")\n\n    count = 0\n    while 1:\n        for data in questions[\"data\"]:\n            kwargs[\"zhihu_offset\"] = count\n            zhihu_download(\"https://www.zhihu.com/question/{}/answer/{}\".format(question_id, data[\"id\"]),\n                           output_dir=output_dir, merge=merge, info_only=info_only, **kwargs)","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/soimort/you-get/blob/049548f3f3f35e67ba8d3181c71fdc71d11cf260/src/you_get/extractors/zhihu.py#L34-L70","documentation":"Entry guard of zhihu_download_playlist (src/you_get/extractors/zhihu.py:52). It requires a question-listing URL: the URL must contain 'question' and must NOT contain 'answer'. Anything else — an answer URL, a column URL, a non-question page — raises this TypeError telling the user only question URLs are supported.","triggerScenarios":"Calling zhihu_download_playlist with an answer permalink (…/question/267782048/answer/490720324 — rejected because 'answer' in url), or with any URL lacking 'question' (e.g. https://zhuanlan.zhihu.com/p/51669862), triggering the `or` branch of `if 'question' not in url or 'answer' in url`.","commonSituations":"Confusing the two entry points: users call the playlist function on a single answer, or call it on a column; wrappers that route every zhihu URL to the playlist function because the extractor's __all__ exports both zhihu_download and zhihu_download_playlist.","solutions":["Call zhihu_download_playlist only with a question URL: https://www.zhihu.com/question/267782048.","For a single answer use zhihu_download('https://www.zhihu.com/question/<qid>/answer/<aid>'); for a column use the zhuanlan URL with zhihu_download.","Route URLs before calling: check for '/answer/' to pick zhihu_download, bare '/question/' to pick the playlist function.","Catch TypeError to give end users a clear message instead of a traceback."],"exampleFix":"# before\nzhihu_download_playlist('https://www.zhihu.com/question/267782048/answer/490720324')  # TypeError\n\n# after\nzhihu_download_playlist('https://www.zhihu.com/question/267782048')","handlingStrategy":"validation","validationCode":"import re\n\ndef is_question_listing_url(url):\n    return bool(re.search(r'^https?://www\\.zhihu\\.com/question/\\d+/?(\\?|$)', url)) and 'answer' not in url","typeGuard":"null","tryCatchPattern":"try:\n    zhihu_download_playlist(url)\nexcept TypeError as e:\n    if 'Support question only' in str(e):\n        print('use a bare question URL, e.g. https://www.zhihu.com/question/267782048')\n    else:\n        raise","preventionTips":["Strip the /answer/<id> suffix before calling the playlist function, or better, call zhihu_download for answer URLs.","Only feed bare /question/<id> URLs to zhihu_download_playlist.","Classify the URL first (answer vs question vs column) and dispatch to the matching entry point."],"tags":["zhihu","playlist","url-validation","typeerror"],"backgroundTag":null,"analyzedSha":"049548f3f3f35e67ba8d3181c71fdc71d11cf260","analyzedAt":"2026-08-15T03:58:15.069Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}