{"record":{"id":"fca1070a1b841221","repo":"soimort/you-get","slug":"unknown-pattern","errorCode":null,"errorMessage":"Unknown pattern","messagePattern":"Unknown pattern","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/you_get/extractors/miaopai.py","lineNumber":175,"sourceCode":"\n    if re.match(r'^http[s]://(.+\\.)?weibo\\.com/(tv/)?show/(\\d{4}:\\w+)', url):\n        return miaopai_download_h5api(url, info_only=info_only, output_dir=output_dir, merge=merge, **kwargs)\n\n    if re.match(r'^http[s]://(.+\\.)?weibo\\.com/show\\?fid=(\\d{4}:\\w+)', url):\n        return miaopai_download_h5api(url, info_only=info_only, output_dir=output_dir, merge=merge, **kwargs)\n\n    fid = match1(url, r'\\?fid=(\\d{4}:\\w+)')\n    if fid is not None:\n        miaopai_download_by_fid(fid, output_dir, merge, info_only)\n    elif '/p/230444' in url:\n        fid = match1(url, r'/p/230444(\\w+)')\n        miaopai_download_by_fid('1034:'+fid, output_dir, merge, info_only)\n        pass\n    else:\n        mobile_page = get_content(url, headers = fake_headers_mobile)\n        hit = re.search(r'\"page_url\"\\s*:\\s*\"([^\"]+)\"', mobile_page)\n        if not hit:\n            raise Exception('Unknown pattern')\n        else:\n            escaped_url = hit.group(1)\n            miaopai_download(urllib.parse.unquote(escaped_url), output_dir=output_dir, merge=merge, info_only=info_only, **kwargs)\n\n\nsite_info = \"miaopai\"\ndownload = miaopai_download\ndownload_playlist = playlist_not_supported('miaopai')\n","sourceCodeStart":157,"sourceCodeEnd":184,"githubUrl":"https://github.com/soimort/you-get/blob/049548f3f3f35e67ba8d3181c71fdc71d11cf260/src/you_get/extractors/miaopai.py#L157-L184","documentation":"Fallback path in miaopai_download: when the URL has no ?fid= and no /p/230444 marker, the extractor fetches the page with mobile headers and looks for r'\"page_url\"\\s*:\\s*\"([^\"]+)\"' in the HTML. If that JSON key is absent (redesign, JS-rendered content, bot wall), it raises Exception('Unknown pattern') — the extractor has no remaining strategy to locate the video.","triggerScenarios":"Fetching a miaopai URL whose served HTML contains no \"page_url\" field: dynamic pages built by JavaScript after load, an error/expired page, or an interstitial requiring login; also URLs of a new share format that skip both fid patterns.","commonSituations":"Site moving to client-side rendering so get_content sees a JS shell; region blocks serving a different page; share links rotting after Miaopai's Weibo integration changes.","solutions":["Prefer the explicit fid form: append/extract ?fid= or use the /p/230444 URL form which take the earlier branches","Inspect mobile_page content in a debugger to see what was actually returned (bot wall vs JS shell)","Update the regex at src/you_get/extractors/miaopai.py:175 to the current embedded field name for the video URL","Find the Weibo oid manually (browser devtools network tab) and call miaopai_download_by_fid directly"],"exampleFix":"# before\nhit = re.search(r'\"page_url\"\\s*:\\s*\"([^\"]+)\"', mobile_page)\nif not hit:\n    raise Exception('Unknown pattern')\n\n# after\nhit = (re.search(r'\"page_url\"\\s*:\\s*\"([^\"]+)\"', mobile_page)\n       or re.search(r'\"video_url\"\\s*:\\s*\"([^\"]+)\"', mobile_page))\nif not hit:\n    raise Exception('Unknown pattern')","handlingStrategy":"try-catch","validationCode":"import re\n\ndef miaopai_page_has_video_url(mobile_html):\n    return re.search(r'\"page_url\"\\s*:\\s*\"([^\"]+)\"', mobile_html) is not None","typeGuard":null,"tryCatchPattern":"try:\n    miaopai_download(url, ...)\nexcept Exception as e:\n    if str(e) == 'Unknown pattern':\n        print('page layout changed or bot wall; extract fid manually')\n    else:\n        raise","preventionTips":["Prefer ?fid= style URLs, which bypass HTML scraping entirely","If scraping is required, verify the HTML actually embeds page_url before parsing","Keep the extractor's regex in sync when Miaopai/Weibo changes its page JSON schema"],"tags":["miaopai","html-scraping","site-redesign","fallback"],"backgroundTag":null,"analyzedSha":"049548f3f3f35e67ba8d3181c71fdc71d11cf260","analyzedAt":"2026-08-15T03:58:15.069Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}