diff --git a/README.md b/README.md index 26bdfa6f..d0fa27f8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,19 @@ -
An object-oriented wrapper around the Innertube API, which is what YouTube itself uses.
+
An object-oriented wrapper around the Innertube API, which is what YouTube itself uses.
-
-
-
-
+
+ Report Bug
+ ·
+ Request Feature
+
+
+
+
+
+
```js { - "search_metadata":{ - "query":"Looking for life on Mars - documentary", - "corrected_query":"Looking for life on Mars - documentary", - "estimated_results":17949539 - }, - "videos":[ + query: string, + corrected_query: string, + estimated_results: number, + videos: [ { - "title":"Looking for Life on Mars | NOVA | PBS", - "description":"Follow along as NASA launches the Mars 2020 Mission, perhaps the most ambitious hunt yet for signs of ancient life on Mars.", - "author":"NOVA PBS Official", - "id":"fhtw7Dpntb4", - "url":"https://youtu.be/fhtw7Dpntb4", - "channel_url":"https://www.youtube.com/user/NOVAonline", - "metadata":{ - "view_count":"3,912,774 views", - "short_view_count_text":{ - "simple_text":"3.9M views", - "accessibility_label":"3.9 million views" + title: string, + description: string, + id: string, + url: string, + metadata:{ + view_count: string, + short_view_count_text: { + simple_text: string, + accessibility_label: string }, - "thumbnails":[ - { - "url":"https://i.ytimg.com/vi/fhtw7Dpntb4/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLDHHsKMNZtmzWn4t14vmmJbBotdQg", - "width":360, - "height":202 - }, - { - "url":"https://i.ytimg.com/vi/fhtw7Dpntb4/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBHzmdEUoQM_Sl-6a-bwMOIm-mM7A", - "width":720, - "height":404 - } - ], - "duration":{ - "seconds":3243, - "simple_text":"54:03", - "accessibility_label":"54 minutes, 3 seconds" + thumbnails: [Array], + duration: { + seconds: number, + simple_text: string, + accessibility_label: string }, - "published":"7 months ago", - "badges":[ - "CC" - ], - "owner_badges":[ - "Verified" - ] + published: string, + badges:[Array], + owner_badges:[Array] } } //... @@ -129,214 +120,65 @@ const search = await youtube.search('Never Gonna Give You Up', { client: 'YTMUSI
```js { - "songs":[ + songs: [ { - "id":"AhCWdFBd_fM", - "title":"Never Gonna Give You Up", - "artist":"Barry White", - "album":"Barry White - His Greatest Hits", - "duration":"4:50", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://lh3.googleusercontent.com/S69XTGGI63L8rJJlCx7rJgp0decIo3EdDKGWR_y8B3SE9fEYp-VGu3ygZ3DrlS3tTTyqN8CUfpajjsA=w60-h60-l90-rj", - "width":60, - "height":60 - }, - { - "url":"https://lh3.googleusercontent.com/S69XTGGI63L8rJJlCx7rJgp0decIo3EdDKGWR_y8B3SE9fEYp-VGu3ygZ3DrlS3tTTyqN8CUfpajjsA=w120-h120-l90-rj", - "width":120, - "height":120 - } - ] + id: string, + title: string, + artist: string, + album: string, + duration: string, + thumbnail: { + thumbnails: [Array] } }, + //... + ], + videos: [ { - "id":"C5ITdcx-wRA", - "title":"Never Gonna Give You Up", - "artist":"Home Free", - "album":"Never Gonna Give You Up", - "duration":"3:03", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://lh3.googleusercontent.com/isnABE6M8Dzq5WG7ZrJRGdKVmF8M8xJDJTM6aMf7d0C-XpqGIHFd1n7i6lgZM_K7LbHXuEuRaXhfnqc=w60-h60-l90-rj", - "width":60, - "height":60 - }, - { - "url":"https://lh3.googleusercontent.com/isnABE6M8Dzq5WG7ZrJRGdKVmF8M8xJDJTM6aMf7d0C-XpqGIHFd1n7i6lgZM_K7LbHXuEuRaXhfnqc=w120-h120-l90-rj", - "width":120, - "height":120 - } - ] - } - }, - { - "id":"XxWzZxuo6Vk", - "title":"Never Gonna Give You Up", - "artist":"Barry White", - "album":"Dinah Washington", - "duration":"The Unforgettable Voices: 30 Best Of Dinah Washington & Barry White", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://lh3.googleusercontent.com/KXnlog1Me9ONfcdtT1O4fHr2uRqYrhH1cHWksFmzNpJwzX8lNr_S5TlQsE8ICtihijkGCLp9y8ypI7BiOA=w60-h60-l90-rj", - "width":60, - "height":60 - }, - { - "url":"https://lh3.googleusercontent.com/KXnlog1Me9ONfcdtT1O4fHr2uRqYrhH1cHWksFmzNpJwzX8lNr_S5TlQsE8ICtihijkGCLp9y8ypI7BiOA=w120-h120-l90-rj", - "width":120, - "height":120 - } - ] + id: string, + title: string, + author: string, + views: string, + duration: string, + thumbnail: { + thumbnails: [Array] } } + //... ], - "videos":[ + albums: [ { - "id":"dMbZfdrzILA", - "title":"Rick Astley - Never Gonna Give You Up • TopPop", - "author":"TopPop", - "views":"313K views", - "duration":"3:25", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://i.ytimg.com/vi/dMbZfdrzILA/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3kLVbR-3q7t0AIjayar6gbsUe-OoQ", - "width":400, - "height":225 - } - ] + title: string, + author: string, + year: string, + thumbnail: { + thumbnails: [Array] } }, - { - "id":"IO9XlQrEt2Y", - "title":"Never Gonna Give You Up", - "author":"Rick Astley", - "views":"7.1M views", - "duration":"2:58", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://i.ytimg.com/vi/IO9XlQrEt2Y/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3mqRLVI-_NB9-t7Qy-j2J030ejrKA", - "width":400, - "height":225 - } - ] - } - }, - { - "id":"a9WHZ5M8I8w", - "title":"Rick Astley - Never Gonna Give You Up - Festival de Viña del Mar 2016 HD", - "author":"FESTIVALDEVINACHILE", - "views":"2.8M views", - "duration":"8:13", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://i.ytimg.com/vi/a9WHZ5M8I8w/sddefault.jpg?sqp=-oaymwEWCJADEOEBIAQqCghqEJQEGHgg6AJIWg&rs=AMzJL3mJDPxemHrcREbbK-9uBM3SIRm-Og", - "width":400, - "height":225 - } - ] - } - } + //... ], - "albums":[ + playlists: [ { - "title":"Never Gonna Give You Up", - "author":"Royal Reggie", - "year":"2022", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://lh3.googleusercontent.com/DeMUgtcPxCOye_JYJaywQjuJHZjdzSYqU-231p8ZADV1EmPC5w3poMQRfm3_U83wLQR0nUbXnJ_Ujyq8=w60-h60-l90-rj", - "width":60, - "height":60 - }, - { - "url":"https://lh3.googleusercontent.com/DeMUgtcPxCOye_JYJaywQjuJHZjdzSYqU-231p8ZADV1EmPC5w3poMQRfm3_U83wLQR0nUbXnJ_Ujyq8=w120-h120-l90-rj", - "width":120, - "height":120 - }, - { - "url":"https://lh3.googleusercontent.com/DeMUgtcPxCOye_JYJaywQjuJHZjdzSYqU-231p8ZADV1EmPC5w3poMQRfm3_U83wLQR0nUbXnJ_Ujyq8=w226-h226-l90-rj", - "width":226, - "height":226 - }, - { - "url":"https://lh3.googleusercontent.com/DeMUgtcPxCOye_JYJaywQjuJHZjdzSYqU-231p8ZADV1EmPC5w3poMQRfm3_U83wLQR0nUbXnJ_Ujyq8=w544-h544-l90-rj", - "width":544, - "height":544 - } - ] - } - }, - { - "title":"Never Gonna Give You Up", - "author":"Carlos Marin", - "year":"2020", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://lh3.googleusercontent.com/i6JslNpviVqPZfLCBvLvmDyscy8ZQ2CShRz38hGj-PUz_H4wLTR0gkKU6tQoREDoARwKBl1krytJdBQ=w60-h60-l90-rj", - "width":60, - "height":60 - }, - { - "url":"https://lh3.googleusercontent.com/i6JslNpviVqPZfLCBvLvmDyscy8ZQ2CShRz38hGj-PUz_H4wLTR0gkKU6tQoREDoARwKBl1krytJdBQ=w120-h120-l90-rj", - "width":120, - "height":120 - }, - { - "url":"https://lh3.googleusercontent.com/i6JslNpviVqPZfLCBvLvmDyscy8ZQ2CShRz38hGj-PUz_H4wLTR0gkKU6tQoREDoARwKBl1krytJdBQ=w226-h226-l90-rj", - "width":226, - "height":226 - }, - { - "url":"https://lh3.googleusercontent.com/i6JslNpviVqPZfLCBvLvmDyscy8ZQ2CShRz38hGj-PUz_H4wLTR0gkKU6tQoREDoARwKBl1krytJdBQ=w544-h544-l90-rj", - "width":544, - "height":544 - } - ] - } - }, - { - "title":"Never Gonna Give You Up", - "author":"Magnus Carlsson", - "year":"2021", - "thumbnail":{ - "thumbnails":[ - { - "url":"https://lh3.googleusercontent.com/43cP--d3Eqj3L5FeBbYFkdsnisf7nYb5-Rq4yZDf1kvH6_pEk4RW4Nd004L4ZwG6VzzT4JzFDVPS-8w=w60-h60-l90-rj", - "width":60, - "height":60 - }, - { - "url":"https://lh3.googleusercontent.com/43cP--d3Eqj3L5FeBbYFkdsnisf7nYb5-Rq4yZDf1kvH6_pEk4RW4Nd004L4ZwG6VzzT4JzFDVPS-8w=w120-h120-l90-rj", - "width":120, - "height":120 - }, - { - "url":"https://lh3.googleusercontent.com/43cP--d3Eqj3L5FeBbYFkdsnisf7nYb5-Rq4yZDf1kvH6_pEk4RW4Nd004L4ZwG6VzzT4JzFDVPS-8w=w226-h226-l90-rj", - "width":226, - "height":226 - }, - { - "url":"https://lh3.googleusercontent.com/43cP--d3Eqj3L5FeBbYFkdsnisf7nYb5-Rq4yZDf1kvH6_pEk4RW4Nd004L4ZwG6VzzT4JzFDVPS-8w=w544-h544-l90-rj", - "width":544, - "height":544 - } - ] - } + title: string, + description: string, + total_items: number, + duration: string, + year: string + items: [ + { + id: string, + title: string, + author: string, + duration: string, + thumbnail: [Array] + } + ] } ] } @@ -346,18 +188,33 @@ const search = await youtube.search('Never Gonna Give You Up', { client: 'YTMUSI
```js -const video = await youtube.getDetails(search.videos[0].id); +[ + { + text: string, bold_text: string + }, + //... +] +``` + +
++ +```js +[ + { + id: string, + title: string, + channel: string, + metadata: { + view_count: string, + thumbnail: { + url: string, + width: number, + height: number + }, + moving_thumbnail: { + url: string, + width: number, + height: number + }, + published: string, + duration: string, + badges: string, + owner_badges: [Array] + } + } +] ```
@@ -1124,22 +491,22 @@ const notifications = await youtube.getNotifications(); ```js [ { - "title":"PewDiePie uploaded: Spoiled Kids Needs To Be Stopped..", - "sent_time":"2 hours ago", - "channel_name":"PewDiePie", - "channel_thumbnail":{ - "url":"https://yt3.ggpht.com/ytc/AKedOLTjRAMaQkJaABC59u63AB9s7UTyQ8enbSoo_TI8cA=s88-c-k-c0x00ffffff-no-rj", - "width":96, - "height":96 + title: string, + sent_time: string, + channel_name: string, + channel_thumbnail: { + url: string, + width: number, + height: number }, - "video_thumbnail":{ - "url":"https://i.ytimg.com/vi/raspGsvKf48/hqdefault.jpg", - "width":640, - "height":360 + video_thumbnail: { + url: string, + width: number, + height: number }, - "video_url":"https://youtu.be/raspGsvKf48", - "read":false, - "notification_id":"1633455444762970" + video_url: string, + read: boolean, + notification_id: string }, //... ] @@ -1154,53 +521,198 @@ Get unseen notifications count: const notifications = await youtube.getUnseenNotificationsCount(); ``` -### Interactions: +Get song lyrics: +```js +const search = await youtube.search('Never give you up', { client: 'YTMUSIC' }); +const lyrics = await youtube.getLyrics(search.songs[0].id); +``` +Get playlist: +```js +const search = await youtube.search('Interstellar Soundtrack', { + client: 'YTMUSIC' +}); + +// YouTube Music +const playlist = await youtube.getPlaylist(search.playlists[0].id, { + client: 'YTMUSIC' +}); + +// YouTube (default) +const playlist = await youtube.getPlaylist(search.playlists[0].id); +``` + + ++ +```js +{ + title: string, + description: string, + total_items: number, + duration: string, + year: string, + items: [ + { + id: string, + title: string, + author: string, + duration: string, + thumbnail: [Array] + }, + //... +} +``` + +
++ +```js +{ + title: string, + description: string, + total_items: string, + last_updated: string, + views: string, + items: [ + { + id: string, + title: string, + author: string, + duration: { + seconds: number, + simple_text: string, + accessibility_label: string + }, + thumbnail: [Array] + }, + //... + ] +} +``` + +
++ +```js +{ + name: string, + photo: [ + { + url: string, + width: number, + height: number + } + ], + country: string, + language: string; +} +``` +
++ +```js +{ + selected_format: { + itag: number, + mimeType: string, + bitrate: number, + initRange: { start: string, end: string }, + indexRange: { start: string, end: string }, + lastModified: string, + contentLength: string, + quality: string, + projectionType: string, + averageBitrate: number, + highReplication: boolean, + audioQuality: string, + approxDurationMs: string, + audioSampleRate: string, + audioChannels: number, + loudnessDb: number, + url: string, + has_audio: boolean, + has_video: boolean + }, + formats: [ + { + itag: number, + mimeType: string, + bitrate: number, + initRange: { start: string, end: string }, + indexRange: { start: string, end: string }, + lastModified: string, + contentLength: string, + quality: string, + projectionType: string, + averageBitrate: number, + highReplication: boolean, + audioQuality: string, + approxDurationMs: string, + audioSampleRate: string, + audioChannels: number, + loudnessDb: number, + url: string, + has_audio: boolean, + has_video: boolean + } + //... + ] +} +``` +
+