{"record":{"id":"58bd0011238d7b78","repo":"iawia002/lux","slug":"youkudata-data-error-note","errorCode":null,"errorMessage":"youkuData.Data.Error.Note","messagePattern":"youkuData\\.Data\\.Error\\.Note","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extractors/youku/youku.go","lineNumber":233,"sourceCode":"\treturn &extractor{}\n}\n\n// Extract is the main function to extract the data.\nfunc (e *extractor) Extract(url string, option extractors.Options) ([]*extractors.Data, error) {\n\tvids := utils.MatchOneOf(\n\t\turl, `id_(.+?)\\.html`, `id_(.+)`,\n\t)\n\tif vids == nil || len(vids) < 2 {\n\t\treturn nil, errors.WithStack(extractors.ErrURLParseFailed)\n\t}\n\tvid := vids[1]\n\n\tyoukuData, err := youkuUps(vid, option)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tif youkuData.Data.Error.Code != 0 {\n\t\treturn nil, errors.New(youkuData.Data.Error.Note)\n\t}\n\tstreams := genData(youkuData.Data)\n\tvar title string\n\tif youkuData.Data.Show.Title == \"\" || strings.Contains(\n\t\tyoukuData.Data.Video.Title, youkuData.Data.Show.Title,\n\t) {\n\t\ttitle = youkuData.Data.Video.Title\n\t} else {\n\t\ttitle = fmt.Sprintf(\"%s %s\", youkuData.Data.Show.Title, youkuData.Data.Video.Title)\n\t}\n\n\treturn []*extractors.Data{\n\t\t{\n\t\t\tSite:    \"优酷 youku.com\",\n\t\t\tTitle:   title,\n\t\t\tType:    extractors.DataTypeVideo,\n\t\t\tStreams: streams,\n\t\t\tURL:     url,","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/iawia002/lux/blob/dd00f6d258d80b6684a0b9402d7124e5c18ef42f/extractors/youku/youku.go#L215-L251","documentation":"The Youku extractor calls youkuUps(vid, option), which resolves a utid from the 'cna' cookie (or fetches one) and queries ups.youku.com get.json with ccode/ckey parameters. If the UPS response carries Data.Error.Code != 0, Youku's own ErrorMsg/Note becomes the error. It means the whole exchange succeeded but Youku refused to hand out stream data for this vid.","triggerScenarios":"Missing or stale cna cookie so the utid sent to UPS is empty/invalid; the default YoukuCcode/YoukuCkey combination being rejected by UPS; deleted or copyright-removed videos; region-restricted content; member-only videos requested without a VIP session.","commonSituations":"Running without any Youku cookies; Youku rotating ckey requirements so the built-in pair stops working; non-mainland IPs being denied certain titles. This is the classic lux+Youku failure mode and usually needs fresh cookies/options.","solutions":["Pass a real browser session cookie containing cna=... via extractors.Options.Cookie","Override the ccode/ckey via the YoukuCcode and YoukuCkey options (CLI flags --youku-ccode / --youku-ckey) with values captured from a working browser session","Confirm the video plays on v.youku.com in a browser from the same network and without VIP if it is member content","If ErrorNote says the video does not exist, drop the URL; if it mentions rights/region, use an appropriate network"],"exampleFix":"// before\noptions := extractors.Options{} // no cookie, default ccode/ckey\n_, err := youku.Extract(url, options)\n\n// after\noptions := extractors.Options{\n    Cookie:     \"cna=YOUR_CNA_FROM_BROWSER; ...\",\n    YoukuCcode: \"0510\",\n    YoukuCkey:  \"YOUR_CAPTURED_CKEY\",\n}\n_, err := youku.Extract(url, options)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := youku.Extract(url, opts)\nif err != nil {\n    if strings.Contains(err.Error(), \"ckey\") || strings.Contains(err.Error(), \"版权\") || strings.Contains(err.Error(), \"地区\") {\n        // auth/geo refusal: refresh cna cookie + ccode/ckey options, retry once\n        opts.Cookie = freshCookie()\n        opts.YoukuCkey = freshCkey()\n        _, err = youku.Extract(url, opts)\n    }\n    return err\n}","preventionTips":["Keep a valid browser cna cookie and pass it via Options.Cookie","Capture ccode/ckey from a working browser session when the built-in pair starts failing","Skip member-only and region-locked titles unless you hold the right session/network"],"tags":["youku","api-error","cookies","drm","geo-restriction"],"backgroundTag":null,"analyzedSha":"dd00f6d258d80b6684a0b9402d7124e5c18ef42f","analyzedAt":"2026-08-15T16:57:31.080Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}