Added URL support for the Video Music properties with typings
This commit is contained in:
parent
9b9c68ef13
commit
b523c4f394
@ -2,13 +2,18 @@ import { YouTubeChannel } from './Channel';
|
||||
import { YouTubeThumbnail } from './Thumbnail';
|
||||
|
||||
interface VideoMusic {
|
||||
song?: string;
|
||||
artist?: string;
|
||||
song?: MusicEntry;
|
||||
artist?: string | MusicEntry;
|
||||
album?: string;
|
||||
writers?: string;
|
||||
license?: string;
|
||||
}
|
||||
|
||||
interface MusicEntry {
|
||||
text?: string;
|
||||
url?: string | undefined;
|
||||
}
|
||||
|
||||
interface VideoOptions {
|
||||
/**
|
||||
* YouTube Video ID
|
||||
|
||||
@ -223,7 +223,7 @@ export async function video_basic_info(url: string, options: InfoOptions = {}):
|
||||
let url = x.metadataRowRenderer.contents[0]?.runs?.[0]?.navigationEndpoint?.commandMetadata?.webCommandMetadata.url;
|
||||
if (title.toLowerCase() === 'song') {
|
||||
music.push({});
|
||||
music[music.length - 1].song = url ? {text, url: `https://www.youtube.com${url}`} : text;
|
||||
music[music.length - 1].song = {text, url: url ? `https://www.youtube.com${url}` : undefined};
|
||||
} else if (music.length === 0) return;
|
||||
else {
|
||||
music[music.length - 1][title.toLowerCase()] = url ? {text, url: `https://www.youtube.com${url}`} : text;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user