{"record":{"id":"7aa57f8f4f9ee09c","repo":"iawia002/lux","slug":"can-not-found-media","errorCode":null,"errorMessage":"can not found media","messagePattern":"can not found media","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extractors/pornhub/pornhub.go","lineNumber":136,"sourceCode":"\n\tif str, err := value.ToString(); err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t} else {\n\t\tif err := json.Unmarshal([]byte(str), &mediaDefinitions); err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t}\n\n\tvar mp4MediaDefinition *MediaDefinition\n\n\tfor _, mediaDefinition := range mediaDefinitions {\n\t\tif mediaDefinition.Format == \"mp4\" {\n\t\t\tmp4MediaDefinition = &mediaDefinition\n\t\t}\n\t}\n\n\tif mp4MediaDefinition == nil {\n\t\treturn nil, errors.New(\"can not found media\")\n\t}\n\n\tresApi, err := request.Get(mp4MediaDefinition.VideoURL, mp4MediaDefinition.VideoURL, map[string]string{\n\t\t\"Cookie\": strings.Join(cookiesArr, \"; \"),\n\t})\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tpornhubs := make([]pornhubData, 0)\n\n\tif err := json.Unmarshal([]byte(resApi), &pornhubs); err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tstreams := make(map[string]*extractors.Stream, len(pornhubs))\n\n\tfor _, data := range pornhubs {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/iawia002/lux/blob/dd00f6d258d80b6684a0b9402d7124e5c18ef42f/extractors/pornhub/pornhub.go#L118-L154","documentation":"Thrown by the PornHub extractor after it parses the page's mediaDefinitions array: it scans for an entry with Format == \"mp4\" and fails to find one. PornHub delivers videos as a list of media definitions in different formats/qualities; if none is labeled mp4, the extractor has no download URL it can use.","triggerScenarios":"Calling Extract on a premium or age-restricted video whose mp4 definitions only appear for logged-in users, a region-blocked video, or a page where anti-bot/consent markup replaced the real player so mediaDefinitions is empty or only contains other formats (e.g. hls).","commonSituations":"No session cookie passed via extractors.Options.Cookie so the consent/age wall is served instead of the video page; premium content accessed without a paid account; the video was removed and the page no longer embeds definitions.","solutions":["Pass a logged-in browser cookie through Options.Cookie so PornHub serves the real player page with mp4 definitions","Verify the video URL plays in a private browser window without login; if it shows a paywall/age wall, the extractor cannot access it either","Check whether the fetched HTML actually contains mediaDefinitions JSON (log the page) to distinguish 'no mp4 format' from 'wrong page served'","Update the extractor to also accept other formats (e.g. hls) if PornHub shifted delivery away from mp4"],"exampleFix":"// before\noptions := extractors.Options{} // no cookie\n_, err := pornhub.Extract(url, options)\n\n// after\noptions := extractors.Options{\n    Cookie: \"ua=...; accessAgeDisclaimer=1; il=v; ...\", // from a logged-in browser session\n}\n_, err := pornhub.Extract(url, options)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := pornhub.Extract(url, opts)\nif err != nil {\n    if strings.Contains(err.Error(), \"can not found media\") {\n        // likely age/premium wall: retry once with a logged-in cookie, else skip\n    }\n    return err\n}","preventionTips":["Always pass a fresh logged-in cookie via Options.Cookie for age-restricted content","Filter premium URLs out of batch input unless you hold a VIP session","Re-verify cookie validity periodically; expired sessions reproduce this error"],"tags":["pornhub","cookies","premium-content","parsing"],"backgroundTag":null,"analyzedSha":"dd00f6d258d80b6684a0b9402d7124e5c18ef42f","analyzedAt":"2026-08-15T16:57:31.080Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}