mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
remove bilibiliDanmuParseFromAv
This commit is contained in:
1 parent
b512ce1b23
commit
de8cbdd375
1 file changed
+1
-17
@@ -39,21 +39,5 @@ export function bilibiliDanmuParseFromXml(xmlString) {
|
||||
export function bilibiliDanmuParseFromUrl(url) {
|
||||
return fetch(url)
|
||||
.then(res => res.text())
|
||||
.then(xmlString => {
|
||||
return bilibiliDanmuParseFromXml(xmlString);
|
||||
});
|
||||
}
|
||||
|
||||
export function bilibiliDanmuParseFromAv(av) {
|
||||
const corsUrl = 'https://cors-anywhere.herokuapp.com/';
|
||||
return fetch(`${corsUrl}https://api.bilibili.com/x/web-interface/view?aid=${av}`)
|
||||
.then(res => res.json())
|
||||
.then(res => {
|
||||
if (res.code === 0 && res.data && res.data.cid) {
|
||||
return bilibiliDanmuParseFromUrl(
|
||||
`${corsUrl}https://api.bilibili.com/x/v1/dm/list.so?oid=${res.data.cid}`,
|
||||
);
|
||||
}
|
||||
throw new Error(`Unable to get data: ${JSON.stringify(res)}`);
|
||||
});
|
||||
.then(xmlString => bilibiliDanmuParseFromXml(xmlString));
|
||||
}
|
||||
Reference in new issue
Block a user