{"record":{"id":"a427f5d5889551e8","repo":"xtekky/gpt4free","slug":"model-must-be-mp3-or-high-definition","errorCode":null,"errorMessage":"model must be 'mp3' or 'high-definition'","messagePattern":"model must be 'mp3' or 'high-definition'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/search/YouTube.py","lineNumber":155,"sourceCode":"                    \"merge_output_format\": \"mp4\",\n                }\n            )\n        elif model == \"720p\":\n            ydl_opts.update(\n                {\n                    \"format\": \"bestvideo[height=720]+bestaudio/best[height=720]\",\n                    \"merge_output_format\": \"mp4\",\n                }\n            )\n        elif model == \"480p\":\n            ydl_opts.update(\n                {\n                    \"format\": \"bestvideo[height<=480]+bestaudio/best[height<=480]\",\n                    \"merge_output_format\": \"mp4\",\n                }\n            )\n        else:\n            raise ValueError(\"model must be 'mp3' or 'high-definition'\")\n\n        with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n            result = ydl.download([video_url])\n            return ydl.prepare_filename(\n                ydl.extract_info(video_url, download=True)\n            ).replace(\".webm\", \".mp3\" if model == \"mp3\" else \".webm\")\n            # You can get actual file path via ydl.prepare_filename\n        # This is a simplified return - usually, you would parse the output or check the directory\n        return output_dir\n\n\n# Example usage (async function to test)\n\n\nasync def demo():\n    provider = YouTubeProvider()\n    results = await provider.search(\"Python programming\", max_results=2)\n    print(\"Search results:\", results)","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/search/YouTube.py#L137-L173","documentation":"Error \"model must be 'mp3' or 'high-definition'\" thrown in xtekky/gpt4free.","triggerScenarios":"Thrown at g4f/Provider/search/YouTube.py:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the model argument to either 'mp3' or 'high-definition'.","Omit the model argument to use the default audio format."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}