yt-dlp: [ie/bilibili] Broken in several bangumi series (grayscale release probably)

Checklist

  • I’m reporting that yt-dlp is broken on a supported site
  • I’ve verified that I have updated yt-dlp to nightly or master (update instructions)
  • I’ve checked that all provided URLs are playable in a browser with the same IP and same login details
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched known issues, the FAQ, and the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I’ve read about sharing account credentials and I’m willing to share it if required

Region

China

Provide a description that is worded well enough to be understood

https://www.bilibili.com/bangumi/play/ep755477

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Command-line config: ['-vU', 'https://www.bilibili.com/bangumi/play/ep755477', '--cookies', 'www.bilibili.com_cookies.txt']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version master@2025.05.06.203259 from yt-dlp/yt-dlp-master-builds (linux_exe)
[debug] Python 3.11.12 (CPython x86_64 64bit) - Linux-6.14.5-cachyos-x86_64-with (OpenSSL 3.1.8 11 Feb 2025)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.22.0, brotli-1.1.0, certifi-2025.04.26, curl_cffi-0.10.0, mutagen-1.47.0, requests-2.32.3, secretstorage-3.3.3, sqlite3-3.44.2, urllib3-2.4.0, websockets-15.0.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Plugin directories: none
[debug] Loaded 1857 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-master-builds/releases/latest
Latest version: master@2025.05.06.203259 from yt-dlp/yt-dlp-master-builds
yt-dlp is up to date (master@2025.05.06.203259 from yt-dlp/yt-dlp-master-builds)
[BiliBiliBangumi] Extracting URL: https://www.bilibili.com/bangumi/play/ep755477
[BiliBiliBangumi] 755477: Downloading webpage
ERROR: [BiliBiliBangumi] 755477: This video is for premium members only. Use --cookies-from-browser or --cookies for the authentication. See  https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp  for how to manually pass cookies
  File "yt_dlp/extractor/common.py", line 748, in extract
  File "yt_dlp/extractor/bilibili.py", line 887, in _real_extract
  File "yt_dlp/extractor/common.py", line 1251, in raise_login_required

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

seems to work

                 'Extracting episode', query={'fnval': 12240, 'ep_id': episode_id},
                 headers=headers))

+        geo_blocked = traverse_obj(play_info, ('raw', 'data', 'plugins', lambda _, v: v['name'] == 'AreaLimitPanel', 'config', 'is_block', {bool}, any))
+
         premium_only = play_info.get('code') == -10403
-        play_info = traverse_obj(play_info, ('result', 'video_info', {dict})) or {}
+        play_info = traverse_obj(play_info, (('result', ('raw', 'data')), 'video_info', {dict}, any)) or {}

         formats = self.extract_formats(play_info)
-        if not formats and (premium_only or '成为大会员抢先看' in webpage or '开通大会员观看' in webpage):
-            self.raise_login_required('This video is for premium members only')
+        if not formats:
+            if geo_blocked:
+                self.raise_geo_restricted()
+            elif premium_only or '成为大会员抢先看' in webpage or '开通大会员观看' in webpage:
+                self.raise_login_required('This video is for premium members only')

         bangumi_info = self._download_json(
             'https://api.bilibili.com/pgc/view/web/season', episode_id, 'Get episode details',

Everything is functioning well now. This command line is convenient. I appreciate your help, and I think it’s ready to be released as part of the stable version in its current state.

@Fullna-ui It conveys to me that you haven’t applied the patch. (And you shouldn’t be trying to apply patches to a pip installation anyways; clone the repository and run from source)

a new kind of playinfo is being rolled out on certain bangumi.

example
{
    "raw": {
        "code": 0,
        "message": "0",
        "ttl": 1,
        "data": {
            "play_video_type": "none",
            "arc": {
                "biz_type": 2,
                "aid": 445106387,
                "cid": 1169826251,
                "bvid": "BV15j411Q7tv"
            },
            "user_status": {
                "is_login": true,
                "follow_info": {},
                "vip_info": {}
            },
            "supplement": {
                "ogv_episode_info": {
                    "episode_id": 755477,
                    "episode_status": 2,
                    "index_title": "3",
                    "long_title": "深夜的东京"
                },
                "record_number": {},
                "ogv_season_info": {
                    "season_id": 44165,
                    "season_type": 3
                }
            },
            "plugins": [
                {
                    "name": "AreaLimitPanel",
                    "config": {
                        "is_block": true
                    }
                }
            ],
            "exp_info": {}
        }
    },
    "body": {
        "format": null,
        "quality": null,
        "timelength": null,
        "streamType": "https",
        "acceptQuality": [],
        "acceptDescription": null,
        "mediaDataSource": {},
        "supportFormats": [],
        "clipInfoList": [],
        "isPreview": false,
        "abTestId": null,
        "dmOffset": 0,
        "session": null,
        "drmTechType": null,
        "lastPlayTime": 0,
        "recordInfo": {
            "record": "",
            "recordIcon": null
        },
        "loudnessParams": null,
        "viewInfo": {
            "qnTrialInfo": null,
            "aiRepairQnTrialInfo": null
        },
        "playViewBusinessInfo": {
            "episodeInfo": {
                "aid": 445106387,
                "cid": 1169826251,
                "ep_id": 755477
            },
            "seasonInfo": {
                "season_id": 44165,
                "season_type": 3
            },
            "userStatus": {
                "watch_progress": {
                    "lastEpId": 0,
                    "lastEpIndex": 0,
                    "lastTime": 0,
                    "currentWatchProgress": 0
                },
                "vip_info": {},
                "pay_info": {
                    "pay_check": false
                },
                "is_login": true
            }
        },
        "lastPlayEpid": null,
        "parsedReportFragmentVideoInfoList": [],
        "parsedFragmentVideoInfoList": [
            {
                "format": null,
                "quality": null,
                "timelength": null,
                "streamType": "https",
                "acceptQuality": [],
                "acceptDescription": null,
                "mediaDataSource": {},
                "supportFormats": [],
                "clipInfoList": [],
                "isPreview": false,
                "abTestId": null,
                "dmOffset": 0,
                "session": null,
                "drmTechType": null,
                "lastPlayTime": 0,
                "recordInfo": {
                    "record": "",
                    "recordIcon": null
                },
                "loudnessParams": null,
                "viewInfo": {
                    "qnTrialInfo": null,
                    "aiRepairQnTrialInfo": null
                },
                "playViewBusinessInfo": {
                    "episodeInfo": {
                        "aid": 445106387,
                        "cid": 1169826251,
                        "ep_id": 755477
                    },
                    "seasonInfo": {
                        "season_id": 44165,
                        "season_type": 3
                    },
                    "userStatus": {
                        "watch_progress": {
                            "lastEpId": 0,
                            "lastEpIndex": 0,
                            "lastTime": 0,
                            "currentWatchProgress": 0
                        },
                        "vip_info": {},
                        "pay_info": {
                            "pay_check": false
                        },
                        "is_login": true
                    }
                },
                "lastPlayEpid": null,
                "parsedReportFragmentVideoInfoList": []
            }
        ]
    },
    "retries": 0
}

I’m geoblocked but I suppose we can extract formats from .body.parsedFragmentVideoInfoList