{"record":{"id":"decd73e2cbc59cb1","repo":"ytdl-org/youtube-dl","slug":"reason","errorCode":null,"errorMessage":"reason","messagePattern":"reason","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"youtube_dl/extractor/googledrive.py","lineNumber":176,"sourceCode":"        origin_lang_code = track.attrib.get('lang_code')\n        if not origin_lang_code:\n            return\n        return self._get_captions_by_type(\n            video_id, subtitles_id, 'automatic_captions', origin_lang_code)\n\n    def _real_extract(self, url):\n        video_id = self._match_id(url)\n        video_info = compat_parse_qs(self._download_webpage(\n            'https://drive.google.com/get_video_info',\n            video_id, query={'docid': video_id}))\n\n        def get_value(key):\n            return try_get(video_info, lambda x: x[key][0])\n\n        reason = get_value('reason')\n        title = get_value('title')\n        if not title and reason:\n            raise ExtractorError(reason, expected=True)\n\n        formats = []\n        fmt_stream_map = (get_value('fmt_stream_map') or '').split(',')\n        fmt_list = (get_value('fmt_list') or '').split(',')\n        if fmt_stream_map and fmt_list:\n            resolutions = {}\n            for fmt in fmt_list:\n                mobj = re.search(\n                    r'^(?P<format_id>\\d+)/(?P<width>\\d+)[xX](?P<height>\\d+)', fmt)\n                if mobj:\n                    resolutions[mobj.group('format_id')] = (\n                        int(mobj.group('width')), int(mobj.group('height')))\n\n            for fmt_stream in fmt_stream_map:\n                fmt_stream_split = fmt_stream.split('|')\n                if len(fmt_stream_split) < 2:\n                    continue\n                format_id, format_url = fmt_stream_split[:2]","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/googledrive.py#L158-L194","documentation":"Raised by the Google Drive extractor when get_video_info returns no 'title' but does return a 'reason' — Drive's own error string (e.g. 'This video is not available' or a quota message). Marked expected=True. This is the early bail-out before any format parsing.","triggerScenarios":"Requesting a Drive docid whose get_video_info response contains reason=... and no title: video removed, made private, download-quota-exceeded, or requires sign-in.","commonSituations":"Shared files that hit Google's daily download quota ('Sorry, you can't view or download this file at this time'), deleted/private videos, or files where the owner disabled downloading.","solutions":["Open the drive.google.com URL in a browser to see the actual reason","If quota-exceeded, wait 24h or ask the owner to make a copy and share the new link","Sign in to Google in a browser and use a cookies-from-browser capable tool (yt-dlp --cookies-from-browser)","If the file is private, get the owner to grant access"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import requests\nfrom urllib.parse import parse_qs\nqi = parse_qs(requests.get('https://drive.google.com/get_video_info', params={'docid': fid}).text)\nif qi.get('reason') and not qi.get('title'):\n    print('Drive refusal:', qi['reason'][0])","typeGuard":"def drive_video_available(video_info_qs):\n    return bool(video_info_qs.get('title')) and not video_info_qs.get('reason')","tryCatchPattern":"try:\n    ydl.extract_info(url)\nexcept DownloadError as e:\n    if 'quota' in str(e).lower() or 'not available' in str(e).lower():\n        schedule_retry_24h(url)  # quota windows reset daily\n    else:\n        raise","preventionTips":["Pre-check get_video_info for a 'reason' field before queueing downloads","For shared files, ask owners to provide copies instead of hitting one file's quota","Use browser cookies for access-controlled files"],"tags":["google-drive","quota","access-denied","extractor"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}