diff --git a/api/src/processing/services/bilibili.js b/api/src/processing/services/bilibili.js index 0e9df7101..3d2cf3568 100644 --- a/api/src/processing/services/bilibili.js +++ b/api/src/processing/services/bilibili.js @@ -17,6 +17,40 @@ function extractBestQuality(dashData) { return [ bestVideo, bestAudio ]; } +function extractStreamDataFromHTML(html) { + const rawStreamData = html.split('')[0]; + if (!rawStreamData) return; + + const data = JSON.parse(rawStreamData); + if (data.code !== 0) return; + + return data; +} + +async function fetchStreamDataFromAPI(html) { + // initial state has required aid and cid (bvid doesn't seem to be required) + const initialStateHtml = html.split('')[0] - ); - if (streamData.data.timelength > env.durationLimit * 1000) { return { error: "content.too_long" }; }