Skip to content

Commit 7780833

Browse files
committed
plugins.bilibili: fix schema for offline channels
1 parent 8bf71b4 commit 7780833

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/streamlink/plugins/bilibili.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ def _get_api_playinfo(self, room_id):
7272
{
7373
"code": 0,
7474
"data": {
75-
"playurl_info": {
76-
"playurl": {
77-
"stream": self._schema_streams(),
75+
"playurl_info": validate.none_or_all(
76+
{
77+
"playurl": {
78+
"stream": self._schema_streams(),
79+
},
7880
},
79-
},
81+
validate.get(("playurl", "stream")),
82+
),
8083
},
8184
},
82-
validate.get(("data", "playurl_info", "playurl", "stream")),
85+
validate.get(("data", "playurl_info")),
8386
),
8487
)
8588

@@ -96,11 +99,14 @@ def _get_page_playinfo(self):
9699
"roomInitRes": {
97100
"data": {
98101
"live_status": int,
99-
"playurl_info": {
100-
"playurl": {
101-
"stream": self._schema_streams(),
102+
"playurl_info": validate.none_or_all(
103+
{
104+
"playurl": {
105+
"stream": self._schema_streams(),
106+
},
102107
},
103-
},
108+
validate.get(("playurl", "stream")),
109+
),
104110
},
105111
},
106112
"roomInfoRes": {
@@ -124,7 +130,7 @@ def _get_page_playinfo(self):
124130
("roomInfoRes", "data", "room_info", "area_name"),
125131
("roomInfoRes", "data", "room_info", "title"),
126132
("roomInitRes", "data", "live_status"),
127-
("roomInitRes", "data", "playurl_info", "playurl", "stream"),
133+
("roomInitRes", "data", "playurl_info"),
128134
),
129135
),
130136
),

0 commit comments

Comments
 (0)