mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 20:47:02 +03:00
Add support for floatie proxy
This commit is contained in:
@@ -201,7 +201,9 @@ addDefaults(config, {
|
|||||||
etagExpiry: 5000,
|
etagExpiry: 5000,
|
||||||
youTubeKeys: {
|
youTubeKeys: {
|
||||||
visitorData: null,
|
visitorData: null,
|
||||||
poToken: null
|
poToken: null,
|
||||||
|
floatieUrl: null,
|
||||||
|
floatieAuth: null
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
loadFromEnv(config);
|
loadFromEnv(config);
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ export interface SBSConfig {
|
|||||||
youTubeKeys: {
|
youTubeKeys: {
|
||||||
visitorData: string | null;
|
visitorData: string | null;
|
||||||
poToken: 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> {
|
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
|
// start subrequest
|
||||||
const url = "https://www.youtube.com/youtubei/v1/player";
|
const url = "https://www.youtube.com/youtubei/v1/player";
|
||||||
const data = {
|
const data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user