mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 11:36:58 +03:00
Add support for floatie proxy
This commit is contained in:
@@ -201,7 +201,9 @@ addDefaults(config, {
|
||||
etagExpiry: 5000,
|
||||
youTubeKeys: {
|
||||
visitorData: null,
|
||||
poToken: null
|
||||
poToken: null,
|
||||
floatieUrl: null,
|
||||
floatieAuth: null
|
||||
}
|
||||
});
|
||||
loadFromEnv(config);
|
||||
|
||||
@@ -115,6 +115,8 @@ export interface SBSConfig {
|
||||
youTubeKeys: {
|
||||
visitorData: string | null;
|
||||
poToken: string | null;
|
||||
floatieUrl: string | null;
|
||||
floatieAuth: string | null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,23 @@ const privateResponse = (videoId: string, reason: string): innerTubeVideoDetails
|
||||
});
|
||||
|
||||
export async function getFromITube (videoID: string): Promise<innerTubeVideoDetails> {
|
||||
if (config.youTubeKeys.floatieUrl) {
|
||||
const result = await axios.get(config.youTubeKeys.floatieUrl, {
|
||||
params: {
|
||||
videoID,
|
||||
auth: config.youTubeKeys.floatieAuth
|
||||
}
|
||||
});
|
||||
|
||||
if (result.status === 200) {
|
||||
return result.data?.videoDetails ?? privateResponse(videoID, result.data?.playabilityStatus?.reason ?? "Bad response");
|
||||
} else if (result.status === 500) {
|
||||
return privateResponse(videoID, result.data ?? "Bad response");
|
||||
} else {
|
||||
return Promise.reject(`Floatie returned non-200 response: ${result.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
// start subrequest
|
||||
const url = "https://www.youtube.com/youtubei/v1/player";
|
||||
const data = {
|
||||
|
||||
Reference in New Issue
Block a user