mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-19 22:18:35 +03:00
Fix issues caused by YouTube API upgrade
This commit is contained in:
@@ -12,7 +12,7 @@ _youTubeAPI.authenticate({
|
|||||||
export class YouTubeAPI {
|
export class YouTubeAPI {
|
||||||
static listVideos(videoID: string, callback: (err: string | boolean, data: any) => void) {
|
static listVideos(videoID: string, callback: (err: string | boolean, data: any) => void) {
|
||||||
const part = 'contentDetails,snippet';
|
const part = 'contentDetails,snippet';
|
||||||
if (videoID.length !== 11 || videoID.includes(".")) {
|
if (!videoID || videoID.length !== 11 || videoID.includes(".")) {
|
||||||
callback("Invalid video ID", undefined);
|
callback("Invalid video ID", undefined);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ export class YouTubeAPI {
|
|||||||
_youTubeAPI.videos.list({
|
_youTubeAPI.videos.list({
|
||||||
part,
|
part,
|
||||||
id: videoID,
|
id: videoID,
|
||||||
}, (ytErr: boolean | string, data: any) => {
|
}, (ytErr: boolean | string, { data }: any) => {
|
||||||
if (!ytErr) {
|
if (!ytErr) {
|
||||||
// Only set cache if data returned
|
// Only set cache if data returned
|
||||||
if (data.items.length > 0) {
|
if (data.items.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user