ipman-youtube-music
Advanced tools
Comparing version 0.12.5 to 0.12.6
@@ -128,2 +128,4 @@ declare enum AccountType { | ||
declare function SearchForVideos(query: string): Promise<MusicVideoSimple[]>; | ||
declare function GetMusicVideoBasedSuggestions(videoId: string): Promise<MusicVideo[]>; | ||
@@ -150,2 +152,2 @@ | ||
export { AccountType, AlbumPreview, AlbumType, Artist, ArtistPreview, GetMusicVideoBasedSuggestions, ListMusicVideosFromAlbum, ListMusicVideosFromPlaylist, MusicVideo, MusicVideoPlayable, MusicVideoSimple, PageType, Playlist, PlaylistPreview, PlaylistTrack, SearchForAlbum, SearchForArtists, SearchForMusicVideos, SearchForPlaylists, getArtist, getPlaylist, getVideo }; | ||
export { AccountType, AlbumPreview, AlbumType, Artist, ArtistPreview, GetMusicVideoBasedSuggestions, ListMusicVideosFromAlbum, ListMusicVideosFromPlaylist, MusicVideo, MusicVideoPlayable, MusicVideoSimple, PageType, Playlist, PlaylistPreview, PlaylistTrack, SearchForAlbum, SearchForArtists, SearchForMusicVideos, SearchForPlaylists, SearchForVideos, getArtist, getPlaylist, getVideo }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var se=Object.create;var g=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var ae=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},C=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of oe(t))!le.call(e,s)&&s!==r&&g(e,s,{get:()=>t[s],enumerable:!(n=ie(t,s))||n.enumerable});return e};var b=(e,t,r)=>(r=e!=null?se(ue(e)):{},C(t||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),me=e=>C(g({},"__esModule",{value:!0}),e);var Ie={};ae(Ie,{AccountType:()=>E,AlbumType:()=>I,GetMusicVideoBasedSuggestions:()=>j,ListMusicVideosFromAlbum:()=>K,ListMusicVideosFromPlaylist:()=>Z,PageType:()=>f,SearchForAlbum:()=>G,SearchForArtists:()=>k,SearchForMusicVideos:()=>H,SearchForPlaylists:()=>Q,getArtist:()=>q,getPlaylist:()=>te,getVideo:()=>ne});module.exports=me(Ie);var E=(r=>(r.REGULAR="regular",r.VERIFIED_ARTIST="BADGE_STYLE_TYPE_VERIFIED_ARTIST",r))(E||{}),I=(n=>(n.ep="EP",n.album="Album",n.single="Single",n))(I||{}),f=(n=>(n.artist="MUSIC_PAGE_TYPE_ARTIST",n.album="MUSIC_PAGE_TYPE_ALBUM",n.playlist="MUSIC_PAGE_TYPE_PLAYLIST",n))(f||{});var h="MUSIC_EXPLICIT_BADGE",x=e=>{let t=e.split(":");return t.length===3?parseInt(t[0],10)*3600+parseInt(t[1],10)*60+parseInt(t[2],10):parseInt(t[0],10)*60+parseInt(t[1],10)},L=e=>{switch(e){case"Album":return"Album";case"EP":return"EP";default:return"Single"}},v=e=>{let t=[];if(e.forEach(r=>{r.navigationEndpoint&&r.navigationEndpoint.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType==="MUSIC_PAGE_TYPE_ARTIST"&&t.push({name:r.text,id:r.navigationEndpoint.browseEndpoint.browseId})}),t.length===0){let r=e.findIndex(n=>n.text===" \u2022 ");r!==-1&&e.filter((n,s)=>s<r&&n.name!==" & ").forEach(n=>t.push({name:n.text}))}return t},T=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint?.videoId}catch{}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let n;try{n=v(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs)}catch{}let s;try{let{length:l}=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs;s={name:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[l-3].text,id:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[l-3].navigationEndpoint.browseEndpoint?.browseId}}catch{}let i;try{i=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}let a;try{let l=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs.length-1].text;a={label:l,totalSeconds:x(l)}}catch{}let u;try{u=e.musicResponsiveListItemRenderer.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{u=!1}return{youtubeId:t,title:r,artists:n,album:s,thumbnailUrl:i,duration:a,isExplicit:u}},A=e=>{let t;try{t=e.playlistPanelVideoRenderer.navigationEndpoint.watchEndpoint.videoId}catch{}let r;try{r=e.playlistPanelVideoRenderer.title.runs[0].text}catch{}let n;try{n=v(e.playlistPanelVideoRenderer.longBylineText.runs)}catch{}let s;try{s={name:e.playlistPanelVideoRenderer.longBylineText.runs[2].text}}catch{}let i;try{i=e.playlistPanelVideoRenderer.badges[0].musicInlineBadgeRenderer.icon.iconType==="MUSIC_EXPLICIT_BADGE"}catch{i=!1}let a;try{a=e.playlistPanelVideoRenderer.thumbnail.thumbnails.pop()?.url}catch{}let u;try{u={label:e.playlistPanelVideoRenderer.lengthText.runs[0].text,totalSeconds:x(e.playlistPanelVideoRenderer.lengthText.runs[0].text)}}catch{}return{youtubeId:t,title:r,artists:n,isExplicit:i,album:s,thumbnailUrl:a,duration:u}},P=(e,t)=>{let r;try{r=e.musicResponsiveListItemRenderer.navigationEndpoint.browseEndpoint.browseId}catch{}if(t&&e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text!=="YouTube Music")return null;let n;try{n=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let s;try{s=parseInt(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].text.split(" ")[0],10)}catch{}let i;try{i=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}return{playlistId:r,title:n,totalSongs:s,thumbnailUrl:i}},S=e=>{let t;try{t=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.buttons[1].musicPlayButtonRenderer?.playNavigationEndpoint.watchEndpoint.playlistId}catch{}let r;try{r=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.title.runs[0].text}catch{}let n;try{n=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.subtitle.runs[0].text}catch{}let s;try{s=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.subtitle.runs[2].text}catch{}let i;try{i=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}let a;try{a=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.secondSubtitle.runs[2].text}catch{}let u=[];try{(e.twoColumnBrowseResultsRenderer.secondaryContents.sectionListRenderer.contents[0].musicShelfRenderer??e.twoColumnBrowseResultsRenderer.secondaryContents.sectionListRenderer.contents[0].musicPlaylistShelfRenderer)?.contents.forEach(o=>{let p={id:"",title:"",durationStr:"",thumbnailUrl:"",artist:void 0,album:void 0};o.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint?.watchEndpoint?.videoId&&(p.id=o.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint?.watchEndpoint?.videoId,p.title=o.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text,p.durationStr=o.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text,p.thumbnailUrl=o.musicResponsiveListItemRenderer.thumbnail?.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url,o.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs?.[0].navigationEndpoint&&(p.artist={artistId:o.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.browseEndpoint?.browseId,name:o.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}),o.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs?.[0].navigationEndpoint&&(p.album={albumId:o.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.browseEndpoint?.browseId,title:o.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}),u.push(p))})}catch(o){console.error(o)}let l;try{let o=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer;l={id:o.straplineTextOne?.runs[0].navigationEndpoint?.browseEndpoint.browseId,name:o.straplineTextOne?.runs[0].text??"YouTube Music",thumbnailUrl:o.straplineThumbnail?.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}}catch{}return{id:t,title:r,type:n,year:s,thumbnailUrl:i,durationStr:a,tracks:u,author:l}},M=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint.videoId}catch{}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let n;try{n=v(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs)}catch{}let s;try{s={name:e.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}}catch{}let i;try{i=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}let a;try{a={label:e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text,totalSeconds:x(e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text)}}catch{}let u;try{u=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{u=!1}return{youtubeId:t,title:r,artists:n,album:s,thumbnailUrl:i,duration:a,isExplicit:u}},F=e=>{let t;try{t=e.musicResponsiveListItemRenderer.navigationEndpoint.browseEndpoint.browseId}catch(o){console.error("Couldn't parse albumId",o)}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch(o){console.error("Couldn't parse title",o)}let n;try{n=L(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text)}catch(o){console.error("Couldn't parse album type",o)}let s;try{s=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(o){console.error("Couldn't parse thumbnailUrl",o)}let i;try{i=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].text}catch(o){console.error("Couldn't parse artist",o)}let a;try{a=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].navigationEndpoint?.browseEndpoint.browseId}catch(o){console.error("Couldn't parse artistId",o)}let u;try{u=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[4].text}catch(o){console.error("Couldn't parse year",o)}let l;try{l=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{l=!1}return{albumId:t,title:r,type:n,thumbnailUrl:s,artist:i,artistId:a,year:u,isExplicit:l}},V=e=>{let t;try{t=e.musicResponsiveHeaderRenderer.subtitle.runs[2].text}catch(s){console.error("Couldn't parse artist from album header",s)}let r;try{r=e.musicResponsiveHeaderRenderer.title.runs[0].text}catch(s){console.error("Couldn't parse title from album header",s)}let n;try{n=e.musicResponsiveHeaderRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(s){console.error("Couldn't parse thumbnailUrl from album header",s)}return{artist:t,album:r,thumbnailUrl:n}},B=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint.videoId}catch{}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let n=[];try{if(e.musicResponsiveListItemRenderer.flexColumns[1]?.musicResponsiveListItemFlexColumnRenderer.text.runs)for(let a=0;a<e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs.length;a+=2)n.push({name:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[a].text})}catch{}let s;try{s={label:e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text,totalSeconds:x(e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text)}}catch{}let i;try{i=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{i=!1}return{youtubeId:t,artists:n,title:r,duration:s,isExplicit:i}},ce=e=>{let t;try{t=e.musicTwoRowItemRenderer.title.runs[0].text}catch(u){console.error("Couldn't get title",u)}let r;try{r=L(e.musicTwoRowItemRenderer.subtitle.runs[0].text)}catch(u){console.error("Couldn't get album type",u)}let n;try{n=e.musicTwoRowItemRenderer.title.runs[0].navigationEndpoint.browseEndpoint.browseId}catch(u){console.error("Couldn't get albumId",u)}let s;try{s=e.musicTwoRowItemRenderer.subtitle.runs.pop()?.text}catch(u){console.error("Couldn't get year",u)}let i;try{i=e.musicTwoRowItemRenderer.subtitleBadges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{i=!1}let a;try{a=e.musicTwoRowItemRenderer.thumbnailRenderer.musicThumbnailRenderer.thumbnail.thumbnails.shift()?.url}catch(u){console.error("Couldn't get thumbnailUrl",u)}return{title:t,type:r,albumId:n,year:s,thumbnailUrl:a,isExplicit:i}},de=e=>{let t;try{t=e.musicTwoRowItemRenderer.title.runs[0].navigationEndpoint.browseEndpoint.browseId}catch(i){console.error("Couldn't get artistId",i)}let r;try{r=e.musicTwoRowItemRenderer.title.runs[0].text}catch(i){console.error("Couldn't get name",i)}let n;try{n=e.musicTwoRowItemRenderer.subtitle.runs[0].text;let i=n.split(" ");i.pop(),n=i.join(" ")}catch{}let s;try{s=e.musicTwoRowItemRenderer.thumbnailRenderer.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(i){console.error("Couldn't get thumbnailUrl",i)}return{artistId:t,name:r,subscribers:n,thumbnailUrl:s}},U=e=>{let{videoDetails:t}=e;return{id:t.videoId,title:t.title,duration:parseInt(t.lengthSeconds,10),artist:{name:t.author,id:t.channelId},thumbnailUrl:t.thumbnail.thumbnails.pop()?.url,type:t.musicVideoType}},X=(e,t)=>{let r;try{r=e.header.musicImmersiveHeaderRenderer?.title.runs[0].text??e.header.musicVisualHeaderRenderer.title.runs[0].text}catch(m){console.error("Couldn't get artist name",m)}let n=e.header.musicImmersiveHeaderRenderer?.description?.runs?.[0]?.text??"",s=[];try{e.header.musicImmersiveHeaderRenderer?(e.header.musicImmersiveHeaderRenderer?.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails).forEach(c=>{s.push(c)}):s.push(e.header.musicVisualHeaderRenderer.foregroundThumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop())}catch(m){console.error("Couldn't get artist thumbnails",m)}let i;try{i=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicShelfRenderer?.title?.runs[0].navigationEndpoint.browseEndpoint.browseId}catch{}let a=[];try{let{contents:m}=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicShelfRenderer;for(let c of m)try{a.push({id:c.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint.videoId,title:c.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text,thumbnailUrl:c.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url,artist:{name:r,id:t},album:{name:c.musicResponsiveListItemRenderer.flexColumns[3].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text,id:c.musicResponsiveListItemRenderer.flexColumns[3].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.browseEndpoint.browseId},type:"song",duration:0})}catch(R){console.log("Skipping track",R)}}catch{}let u=[];try{let m=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.find(c=>c.musicCarouselShelfRenderer!==void 0&&c.musicCarouselShelfRenderer.header.musicCarouselShelfBasicHeaderRenderer.title.runs[0].text==="Videos");if(m&&m.musicCarouselShelfRenderer?.contents)for(let c of m.musicCarouselShelfRenderer?.contents)try{u.push({id:c.musicTwoRowItemRenderer.navigationEndpoint.watchEndpoint.videoId,title:c.musicTwoRowItemRenderer.title.runs[0].text,thumbnailUrl:c.musicTwoRowItemRenderer.thumbnailRenderer.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url,artist:{name:r,id:t}})}catch(R){console.log("Skipping video",R)}}catch{}let l=[],o=[];try{let{contents:m}=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer;for(let c of m)c.musicCarouselShelfRenderer?.contents&&c.musicCarouselShelfRenderer.contents[0].musicTwoRowItemRenderer.title.runs[0].navigationEndpoint?.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType==="MUSIC_PAGE_TYPE_ALBUM"&&c.musicCarouselShelfRenderer.contents.forEach(R=>{let y=ce(R);y.type==="Single"?o.push(y):l.push(y)})}catch(m){console.error("Couldn't get albums",m)}let p=[];try{let{contents:m}=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer;for(let c=m.length-1;c>=0;c-=1)if(m[c].musicCarouselShelfRenderer){m[c].musicCarouselShelfRenderer.contents[0].musicTwoRowItemRenderer.title.runs[0].navigationEndpoint.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType==="MUSIC_PAGE_TYPE_ARTIST"&&m[c].musicCarouselShelfRenderer.contents.forEach(R=>{p.push(de(R))});break}}catch{}let w;try{w=e.header.musicImmersiveHeaderRenderer.subscriptionButton?.subscribeButtonRenderer.subscriberCountWithSubscribeText.runs[0].text}catch{}return{artistId:t,name:r,description:n,albums:l,singles:o,thumbnails:s,songsPlaylistId:i,suggestedArtists:p,subscribers:w,songs:a,videos:u}},D=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch(i){console.error("Couldn't get name",i)}let r;try{r=e.musicResponsiveListItemRenderer.navigationEndpoint.browseEndpoint.browseId}catch(i){console.error("Couldn't get artistId",i)}let n;try{n=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(i){console.error("Couldn't get thumbnailUrl",i)}let s;try{s=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].text}catch{}return{name:t,artistId:r,thumbnailUrl:n,subscribers:s}};var d={body:{context:{client:{userAgent:"Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0,gzip(gfe)",clientName:"WEB_REMIX",clientVersion:"1.20241016.01.00",platform:"DESKTOP",browserName:"Firefox",browserVersion:"131.0",acceptHeader:"application/json"}}}};var W=b(require("axios")),pe=e=>{let{contents:t}=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer,r=[];return t.forEach(n=>{try{let s=T(n);s&&r.push(s)}catch(s){console.error(s)}}),r};async function H(e){let t="https://music.youtube.com/youtubei/v1/search?alt=json",r={...d.body,params:"EgWKAQIIAWoKEAoQCRADEAQQBQ%3D%3D",query:e,originalQuery:e,searchMethod:"ENTER_KEY",validationStatus:"VALID"};try{let n=await W.default.post(t,r,{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return pe(n.data)}catch(n){return console.error("Error fetching data:",n),[]}}var _=b(require("axios"));var be=e=>{let{contents:t}=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer,r=[];return t.forEach(n=>{try{let s=D(n);s&&r.push(s)}catch(s){console.error(s)}}),r};async function k(e,t){try{let r=await _.default.post("https://music.youtube.com/youtubei/v1/search",{...d.body,params:"EgWKAQIgAWoKEAMQBBAJEAoQBQ%3D%3D",query:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return be(r.data)}catch(r){return console.error(r),[]}}var N=b(require("axios"));var Re=e=>{let{contents:t}=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer,r=[];return t.forEach(n=>{try{let s=F(n);s&&r.push(s)}catch(s){console.error(s)}}),r};async function G(e){try{let t=await N.default.post("https://music.youtube.com/youtubei/v1/search",{...d.body,params:"EgWKAQIYAWoKEAkQAxAEEAUQCg%3D%3D",query:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return Re(t.data)}catch(t){return console.error(t),[]}}var z=b(require("axios"));var he=(e,t)=>{let r=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer?.contents;if(!r)return[];let n=[];return r.forEach(s=>{try{let i=P(s,t);i&&n.push(i)}catch(i){console.error(i)}}),n};async function Q(e,t){let r=await z.default.post("https://music.youtube.com/youtubei/v1/search",{...d.body,params:"EgWKAQIoAWoKEAoQAxAEEAUQCQ%3D%3D",query:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return he(r.data,t?.onlyOfficialPlaylists??!1)}catch(n){return console.error(n),[]}}var Y=b(require("axios")),ge=e=>{let{contents:t}=e.contents.singleColumnMusicWatchNextResultsRenderer.tabbedRenderer.watchNextTabbedResultsRenderer.tabs[0].tabRenderer.content.musicQueueRenderer.content.playlistPanelRenderer,r=[];return t.forEach(n=>{try{let s=A(n);s&&r.push(s)}catch(s){console.error(s)}}),r};async function j(e){let t=await Y.default.post("https://music.youtube.com/youtubei/v1/next",{...d.body,enablePersistentPlaylistPanel:!0,isAudioOnly:!0,params:"mgMDCNgE",playerParams:"igMDCNgE",tunerSettingValue:"AUTOMIX_SETTING_NORMAL",playlistId:`RDAMVM${e}`,videoId:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return ge(t.data)}catch{return[]}}var O=b(require("axios")),xe=e=>{let{contents:t}=e.contents.twoColumnBrowseResultsRenderer.secondaryContents.sectionListRenderer.contents[0].musicShelfRenderer,r=[],{thumbnailUrl:n,artist:s,album:i}=V(e.contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0]);return t.forEach(a=>{try{let u=B(a);u&&(u.album=i,u.artists?.length===0&&(u.artists=[{name:s}]),u.thumbnailUrl=n,r.push(u))}catch(u){console.error(u)}}),r};async function K(e){try{let t=await O.default.post("https://music.youtube.com/youtubei/v1/browse",{...d.body,browseId:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return xe(t.data)}catch(t){return console.error(t),[]}}var J=b(require("axios"));var ye=e=>{let t=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0],{contents:r}=t.musicPlaylistShelfRenderer??t.musicCarouselShelfRenderer,n=[];return r.forEach(s=>{try{let i=M(s);i&&n.push(i)}catch(i){console.error(i)}}),n};async function Z(e){let t;e.startsWith("VL")||(t="VL"+e);try{let r=await J.default.post("https://music.youtube.com/youtubei/v1/browse",{...d.body,browseId:t},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return ye(r.data)}catch(r){return console.error(`Error in listMusicsFromPlaylist: ${r}`),[]}}var $=b(require("axios"));async function q(e,t){let r=await $.default.post("https://music.youtube.com/youtubei/v1/browse?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30",{...d.body,browseId:e},{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return X(r.data,e)}catch(n){return console.error(n),{}}}var ee=b(require("axios"));async function te(e,t){let r=await ee.default.post("https://music.youtube.com/youtubei/v1/browse?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30",{...d.body,browseId:e},{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{let n=S(r.data.contents);return n&&(n.id=e),n}catch(n){return console.error(n),null}}var re=b(require("axios"));async function ne(e,t){let r=await re.default.post("https://music.youtube.com/youtubei/v1/player",{...d.body,playbackContext:{contentPlaybackContext:{autoCaptionsDefaultOn:!1,html5Preference:"HTML5_PREF_WANTS",lactMilliseconds:"411",mdxContext:{},referer:"https://music.youtube.com/",signatureTimestamp:20024,vis:10}},videoId:e},{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return U(r.data)}catch(n){return console.error(n),{}}}0&&(module.exports={AccountType,AlbumType,GetMusicVideoBasedSuggestions,ListMusicVideosFromAlbum,ListMusicVideosFromPlaylist,PageType,SearchForAlbum,SearchForArtists,SearchForMusicVideos,SearchForPlaylists,getArtist,getPlaylist,getVideo}); | ||
"use strict";var oe=Object.create;var g=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var ce=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},E=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of le(t))!me.call(e,n)&&n!==r&&g(e,n,{get:()=>t[n],enumerable:!(s=ue(t,n))||s.enumerable});return e};var p=(e,t,r)=>(r=e!=null?oe(ae(e)):{},E(t||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),de=e=>E(g({},"__esModule",{value:!0}),e);var we={};ce(we,{AccountType:()=>L,AlbumType:()=>f,GetMusicVideoBasedSuggestions:()=>K,ListMusicVideosFromAlbum:()=>Z,ListMusicVideosFromPlaylist:()=>q,PageType:()=>v,SearchForAlbum:()=>k,SearchForArtists:()=>_,SearchForMusicVideos:()=>H,SearchForPlaylists:()=>z,SearchForVideos:()=>j,getArtist:()=>te,getPlaylist:()=>se,getVideo:()=>ie});module.exports=de(we);var L=(r=>(r.REGULAR="regular",r.VERIFIED_ARTIST="BADGE_STYLE_TYPE_VERIFIED_ARTIST",r))(L||{}),f=(s=>(s.ep="EP",s.album="Album",s.single="Single",s))(f||{}),v=(s=>(s.artist="MUSIC_PAGE_TYPE_ARTIST",s.album="MUSIC_PAGE_TYPE_ALBUM",s.playlist="MUSIC_PAGE_TYPE_PLAYLIST",s))(v||{});var h="MUSIC_EXPLICIT_BADGE",x=e=>{let t=e.split(":");return t.length===3?parseInt(t[0],10)*3600+parseInt(t[1],10)*60+parseInt(t[2],10):parseInt(t[0],10)*60+parseInt(t[1],10)},A=e=>{switch(e){case"Album":return"Album";case"EP":return"EP";default:return"Single"}},w=e=>{let t=[];if(e.forEach(r=>{r.navigationEndpoint&&r.navigationEndpoint.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType==="MUSIC_PAGE_TYPE_ARTIST"&&t.push({name:r.text,id:r.navigationEndpoint.browseEndpoint.browseId})}),t.length===0){let r=e.findIndex(s=>s.text===" \u2022 ");r!==-1&&e.filter((s,n)=>n<r&&s.name!==" & ").forEach(s=>t.push({name:s.text}))}return t},y=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint?.videoId}catch{}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let s;try{s=w(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs)}catch{}let n;try{let{length:l}=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs;n={name:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[l-3].text,id:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[l-3].navigationEndpoint.browseEndpoint?.browseId}}catch{}let i;try{i=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}let a;try{let l=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs.length-1].text;a={label:l,totalSeconds:x(l)}}catch{}let u;try{u=e.musicResponsiveListItemRenderer.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{u=!1}return{youtubeId:t,title:r,artists:s,album:n,thumbnailUrl:i,duration:a,isExplicit:u}},T=e=>{let t;try{t=e.playlistPanelVideoRenderer.navigationEndpoint.watchEndpoint.videoId}catch{}let r;try{r=e.playlistPanelVideoRenderer.title.runs[0].text}catch{}let s;try{s=w(e.playlistPanelVideoRenderer.longBylineText.runs)}catch{}let n;try{n={name:e.playlistPanelVideoRenderer.longBylineText.runs[2].text}}catch{}let i;try{i=e.playlistPanelVideoRenderer.badges[0].musicInlineBadgeRenderer.icon.iconType==="MUSIC_EXPLICIT_BADGE"}catch{i=!1}let a;try{a=e.playlistPanelVideoRenderer.thumbnail.thumbnails.pop()?.url}catch{}let u;try{u={label:e.playlistPanelVideoRenderer.lengthText.runs[0].text,totalSeconds:x(e.playlistPanelVideoRenderer.lengthText.runs[0].text)}}catch{}return{youtubeId:t,title:r,artists:s,isExplicit:i,album:n,thumbnailUrl:a,duration:u}},P=(e,t)=>{let r;try{r=e.musicResponsiveListItemRenderer.navigationEndpoint.browseEndpoint.browseId}catch{}if(t&&e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text!=="YouTube Music")return null;let s;try{s=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let n;try{n=parseInt(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].text.split(" ")[0],10)}catch{}let i;try{i=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}return{playlistId:r,title:s,totalSongs:n,thumbnailUrl:i}},S=e=>{let t;try{t=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.buttons[1].musicPlayButtonRenderer?.playNavigationEndpoint.watchEndpoint.playlistId}catch{}let r;try{r=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.title.runs[0].text}catch{}let s;try{s=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.subtitle.runs[0].text}catch{}let n;try{n=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.subtitle.runs[2].text}catch{}let i;try{i=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}let a;try{a=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer.secondSubtitle.runs[2].text}catch{}let u=[];try{(e.twoColumnBrowseResultsRenderer.secondaryContents.sectionListRenderer.contents[0].musicShelfRenderer??e.twoColumnBrowseResultsRenderer.secondaryContents.sectionListRenderer.contents[0].musicPlaylistShelfRenderer)?.contents.forEach(o=>{let b={id:"",title:"",durationStr:"",thumbnailUrl:"",artist:void 0,album:void 0};o.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint?.watchEndpoint?.videoId&&(b.id=o.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint?.watchEndpoint?.videoId,b.title=o.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text,b.durationStr=o.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text,b.thumbnailUrl=o.musicResponsiveListItemRenderer.thumbnail?.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url,o.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs?.[0].navigationEndpoint&&(b.artist={artistId:o.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.browseEndpoint?.browseId,name:o.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}),o.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs?.[0].navigationEndpoint&&(b.album={albumId:o.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.browseEndpoint?.browseId,title:o.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}),u.push(b))})}catch(o){console.error(o)}let l;try{let o=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer;l={id:o.straplineTextOne?.runs[0].navigationEndpoint?.browseEndpoint.browseId,name:o.straplineTextOne?.runs[0].text??"YouTube Music",thumbnailUrl:o.straplineThumbnail?.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}}catch{}return{id:t,title:r,type:s,year:n,thumbnailUrl:i,durationStr:a,tracks:u,author:l}},M=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint.videoId}catch{}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let s;try{s=w(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs)}catch{}let n;try{n={name:e.musicResponsiveListItemRenderer.flexColumns[2].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}}catch{}let i;try{i=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}let a;try{a={label:e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text,totalSeconds:x(e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text)}}catch{}let u;try{u=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{u=!1}return{youtubeId:t,title:r,artists:s,album:n,thumbnailUrl:i,duration:a,isExplicit:u}},F=e=>{let t;try{t=e.musicResponsiveListItemRenderer.navigationEndpoint.browseEndpoint.browseId}catch(o){console.error("Couldn't parse albumId",o)}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch(o){console.error("Couldn't parse title",o)}let s;try{s=A(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text)}catch(o){console.error("Couldn't parse album type",o)}let n;try{n=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(o){console.error("Couldn't parse thumbnailUrl",o)}let i;try{i=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].text}catch(o){console.error("Couldn't parse artist",o)}let a;try{a=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].navigationEndpoint?.browseEndpoint.browseId}catch(o){console.error("Couldn't parse artistId",o)}let u;try{u=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[4].text}catch(o){console.error("Couldn't parse year",o)}let l;try{l=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{l=!1}return{albumId:t,title:r,type:s,thumbnailUrl:n,artist:i,artistId:a,year:u,isExplicit:l}},V=e=>{let t;try{t=e.musicResponsiveHeaderRenderer.subtitle.runs[2].text}catch(n){console.error("Couldn't parse artist from album header",n)}let r;try{r=e.musicResponsiveHeaderRenderer.title.runs[0].text}catch(n){console.error("Couldn't parse title from album header",n)}let s;try{s=e.musicResponsiveHeaderRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(n){console.error("Couldn't parse thumbnailUrl from album header",n)}return{artist:t,album:r,thumbnailUrl:s}},B=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint.videoId}catch{}let r;try{r=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch{}let s=[];try{if(e.musicResponsiveListItemRenderer.flexColumns[1]?.musicResponsiveListItemFlexColumnRenderer.text.runs)for(let a=0;a<e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs.length;a+=2)s.push({name:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[a].text})}catch{}let n;try{n={label:e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text,totalSeconds:x(e.musicResponsiveListItemRenderer.fixedColumns[0].musicResponsiveListItemFixedColumnRenderer.text.runs[0].text)}}catch{}let i;try{i=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{i=!1}return{youtubeId:t,artists:s,title:r,duration:n,isExplicit:i}},pe=e=>{let t;try{t=e.musicTwoRowItemRenderer.title.runs[0].text}catch(u){console.error("Couldn't get title",u)}let r;try{r=A(e.musicTwoRowItemRenderer.subtitle.runs[0].text)}catch(u){console.error("Couldn't get album type",u)}let s;try{s=e.musicTwoRowItemRenderer.title.runs[0].navigationEndpoint.browseEndpoint.browseId}catch(u){console.error("Couldn't get albumId",u)}let n;try{n=e.musicTwoRowItemRenderer.subtitle.runs.pop()?.text}catch(u){console.error("Couldn't get year",u)}let i;try{i=e.musicTwoRowItemRenderer.subtitleBadges[0].musicInlineBadgeRenderer.icon.iconType===h}catch{i=!1}let a;try{a=e.musicTwoRowItemRenderer.thumbnailRenderer.musicThumbnailRenderer.thumbnail.thumbnails.shift()?.url}catch(u){console.error("Couldn't get thumbnailUrl",u)}return{title:t,type:r,albumId:s,year:n,thumbnailUrl:a,isExplicit:i}},be=e=>{let t;try{t=e.musicTwoRowItemRenderer.title.runs[0].navigationEndpoint.browseEndpoint.browseId}catch(i){console.error("Couldn't get artistId",i)}let r;try{r=e.musicTwoRowItemRenderer.title.runs[0].text}catch(i){console.error("Couldn't get name",i)}let s;try{s=e.musicTwoRowItemRenderer.subtitle.runs[0].text;let i=s.split(" ");i.pop(),s=i.join(" ")}catch{}let n;try{n=e.musicTwoRowItemRenderer.thumbnailRenderer.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(i){console.error("Couldn't get thumbnailUrl",i)}return{artistId:t,name:r,subscribers:s,thumbnailUrl:n}},U=e=>{let{videoDetails:t}=e;return{id:t.videoId,title:t.title,duration:parseInt(t.lengthSeconds,10),artist:{name:t.author,id:t.channelId},thumbnailUrl:t.thumbnail.thumbnails.pop()?.url,type:t.musicVideoType}},D=(e,t)=>{let r;try{r=e.header.musicImmersiveHeaderRenderer?.title.runs[0].text??e.header.musicVisualHeaderRenderer.title.runs[0].text}catch(m){console.error("Couldn't get artist name",m)}let s=e.header.musicImmersiveHeaderRenderer?.description?.runs?.[0]?.text??"",n=[];try{e.header.musicImmersiveHeaderRenderer?(e.header.musicImmersiveHeaderRenderer?.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails).forEach(c=>{n.push(c)}):n.push(e.header.musicVisualHeaderRenderer.foregroundThumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop())}catch(m){console.error("Couldn't get artist thumbnails",m)}let i;try{i=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicShelfRenderer?.title?.runs[0].navigationEndpoint.browseEndpoint.browseId}catch{}let a=[];try{let{contents:m}=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicShelfRenderer;for(let c of m)try{a.push({id:c.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.watchEndpoint.videoId,title:c.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text,thumbnailUrl:c.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url,artist:{name:r,id:t},album:{name:c.musicResponsiveListItemRenderer.flexColumns[3].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text,id:c.musicResponsiveListItemRenderer.flexColumns[3].musicResponsiveListItemFlexColumnRenderer.text.runs[0].navigationEndpoint.browseEndpoint.browseId},type:"song",duration:0})}catch(R){console.log("Skipping track",R)}}catch{}let u=[];try{let m=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.find(c=>c.musicCarouselShelfRenderer!==void 0&&c.musicCarouselShelfRenderer.header.musicCarouselShelfBasicHeaderRenderer.title.runs[0].text==="Videos");if(m&&m.musicCarouselShelfRenderer?.contents)for(let c of m.musicCarouselShelfRenderer?.contents)try{u.push({id:c.musicTwoRowItemRenderer.navigationEndpoint.watchEndpoint.videoId,title:c.musicTwoRowItemRenderer.title.runs[0].text,thumbnailUrl:c.musicTwoRowItemRenderer.thumbnailRenderer.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url,artist:{name:r,id:t}})}catch(R){console.log("Skipping video",R)}}catch{}let l=[],o=[];try{let{contents:m}=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer;for(let c of m)c.musicCarouselShelfRenderer?.contents&&c.musicCarouselShelfRenderer.contents[0].musicTwoRowItemRenderer.title.runs[0].navigationEndpoint?.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType==="MUSIC_PAGE_TYPE_ALBUM"&&c.musicCarouselShelfRenderer.contents.forEach(R=>{let I=pe(R);I.type==="Single"?o.push(I):l.push(I)})}catch(m){console.error("Couldn't get albums",m)}let b=[];try{let{contents:m}=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer;for(let c=m.length-1;c>=0;c-=1)if(m[c].musicCarouselShelfRenderer){m[c].musicCarouselShelfRenderer.contents[0].musicTwoRowItemRenderer.title.runs[0].navigationEndpoint.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType==="MUSIC_PAGE_TYPE_ARTIST"&&m[c].musicCarouselShelfRenderer.contents.forEach(R=>{b.push(be(R))});break}}catch{}let C;try{C=e.header.musicImmersiveHeaderRenderer.subscriptionButton?.subscribeButtonRenderer.subscriberCountWithSubscribeText.runs[0].text}catch{}return{artistId:t,name:r,description:s,albums:l,singles:o,thumbnails:n,songsPlaylistId:i,suggestedArtists:b,subscribers:C,songs:a,videos:u}},X=e=>{let t;try{t=e.musicResponsiveListItemRenderer.flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}catch(i){console.error("Couldn't get name",i)}let r;try{r=e.musicResponsiveListItemRenderer.navigationEndpoint.browseEndpoint.browseId}catch(i){console.error("Couldn't get artistId",i)}let s;try{s=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch(i){console.error("Couldn't get thumbnailUrl",i)}let n;try{n=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[2].text}catch{}return{name:t,artistId:r,thumbnailUrl:s,subscribers:n}};var d={body:{context:{client:{userAgent:"Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0,gzip(gfe)",clientName:"WEB_REMIX",clientVersion:"1.20241016.01.00",platform:"DESKTOP",browserName:"Firefox",browserVersion:"131.0",acceptHeader:"application/json"}}}};var W=p(require("axios")),Re=e=>{let{contents:t}=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer,r=[];return t.forEach(s=>{try{let n=y(s);n&&r.push(n)}catch(n){console.error(n)}}),r};async function H(e){let t="https://music.youtube.com/youtubei/v1/search?alt=json",r={...d.body,params:"EgWKAQIIAWoKEAoQCRADEAQQBQ%3D%3D",query:e,originalQuery:e,searchMethod:"ENTER_KEY",validationStatus:"VALID"};try{let s=await W.default.post(t,r,{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return Re(s.data)}catch(s){return console.error("Error fetching data:",s),[]}}var Q=p(require("axios"));var he=e=>{let{contents:t}=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer,r=[];return t.forEach(s=>{try{let n=X(s);n&&r.push(n)}catch(n){console.error(n)}}),r};async function _(e,t){try{let r=await Q.default.post("https://music.youtube.com/youtubei/v1/search",{...d.body,params:"EgWKAQIgAWoKEAMQBBAJEAoQBQ%3D%3D",query:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return he(r.data)}catch(r){return console.error(r),[]}}var N=p(require("axios"));var ge=e=>{let{contents:t}=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer,r=[];return t.forEach(s=>{try{let n=F(s);n&&r.push(n)}catch(n){console.error(n)}}),r};async function k(e){try{let t=await N.default.post("https://music.youtube.com/youtubei/v1/search",{...d.body,params:"EgWKAQIYAWoKEAkQAxAEEAUQCg%3D%3D",query:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return ge(t.data)}catch(t){return console.error(t),[]}}var G=p(require("axios"));var xe=(e,t)=>{let r=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer?.contents;if(!r)return[];let s=[];return r.forEach(n=>{try{let i=P(n,t);i&&s.push(i)}catch(i){console.error(i)}}),s};async function z(e,t){let r=await G.default.post("https://music.youtube.com/youtubei/v1/search",{...d.body,params:"EgWKAQIoAWoKEAoQAxAEEAUQCQ%3D%3D",query:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return xe(r.data,t?.onlyOfficialPlaylists??!1)}catch(s){return console.error(s),[]}}var Y=p(require("axios")),ye=e=>{let{contents:t}=e.contents.tabbedSearchResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents.pop().musicShelfRenderer,r=[];return t.forEach(s=>{try{let n=y(s);n&&r.push(n)}catch(n){console.error(n)}}),r};async function j(e){let t="https://music.youtube.com/youtubei/v1/search?alt=json",r={...d.body,params:"EgWKAQIQAWoQEAMQBBAJEAoQBRAREBAQFQ%3D%3D",query:e,originalQuery:e,searchMethod:"ENTER_KEY",validationStatus:"VALID"};try{let s=await Y.default.post(t,r,{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return ye(s.data).map(i=>({id:i.youtubeId,title:i.title,artist:{id:i.artists?.[0]?.id,name:i.artists?.[0].name||""}}))}catch(s){return console.error("Error fetching data:",s),[]}}var O=p(require("axios")),Ie=e=>{let{contents:t}=e.contents.singleColumnMusicWatchNextResultsRenderer.tabbedRenderer.watchNextTabbedResultsRenderer.tabs[0].tabRenderer.content.musicQueueRenderer.content.playlistPanelRenderer,r=[];return t.forEach(s=>{try{let n=T(s);n&&r.push(n)}catch(n){console.error(n)}}),r};async function K(e){let t=await O.default.post("https://music.youtube.com/youtubei/v1/next",{...d.body,enablePersistentPlaylistPanel:!0,isAudioOnly:!0,params:"mgMDCNgE",playerParams:"igMDCNgE",tunerSettingValue:"AUTOMIX_SETTING_NORMAL",playlistId:`RDAMVM${e}`,videoId:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return Ie(t.data)}catch{return[]}}var J=p(require("axios")),fe=e=>{let{contents:t}=e.contents.twoColumnBrowseResultsRenderer.secondaryContents.sectionListRenderer.contents[0].musicShelfRenderer,r=[],{thumbnailUrl:s,artist:n,album:i}=V(e.contents.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0]);return t.forEach(a=>{try{let u=B(a);u&&(u.album=i,u.artists?.length===0&&(u.artists=[{name:n}]),u.thumbnailUrl=s,r.push(u))}catch(u){console.error(u)}}),r};async function Z(e){try{let t=await J.default.post("https://music.youtube.com/youtubei/v1/browse",{...d.body,browseId:e},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return fe(t.data)}catch(t){return console.error(t),[]}}var $=p(require("axios"));var ve=e=>{let t=e.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0],{contents:r}=t.musicPlaylistShelfRenderer??t.musicCarouselShelfRenderer,s=[];return r.forEach(n=>{try{let i=M(n);i&&s.push(i)}catch(i){console.error(i)}}),s};async function q(e){let t;e.startsWith("VL")||(t="VL"+e);try{let r=await $.default.post("https://music.youtube.com/youtubei/v1/browse",{...d.body,browseId:t},{params:{alt:"json",key:"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30"},headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});return ve(r.data)}catch(r){return console.error(`Error in listMusicsFromPlaylist: ${r}`),[]}}var ee=p(require("axios"));async function te(e,t){let r=await ee.default.post("https://music.youtube.com/youtubei/v1/browse?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30",{...d.body,browseId:e},{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return D(r.data,e)}catch(s){return console.error(s),{}}}var re=p(require("axios"));async function se(e,t){let r=await re.default.post("https://music.youtube.com/youtubei/v1/browse?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30",{...d.body,browseId:e},{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{let s=S(r.data.contents);return s&&(s.id=e),s}catch(s){return console.error(s),null}}var ne=p(require("axios"));async function ie(e,t){let r=await ne.default.post("https://music.youtube.com/youtubei/v1/player",{...d.body,playbackContext:{contentPlaybackContext:{autoCaptionsDefaultOn:!1,html5Preference:"HTML5_PREF_WANTS",lactMilliseconds:"411",mdxContext:{},referer:"https://music.youtube.com/",signatureTimestamp:20024,vis:10}},videoId:e},{headers:{"User-Agent":"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)","Accept-Language":t?.lang??"en",origin:"https://music.youtube.com",referer:"https://music.youtube.com/"}});try{return U(r.data)}catch(s){return console.error(s),{}}}0&&(module.exports={AccountType,AlbumType,GetMusicVideoBasedSuggestions,ListMusicVideosFromAlbum,ListMusicVideosFromPlaylist,PageType,SearchForAlbum,SearchForArtists,SearchForMusicVideos,SearchForPlaylists,SearchForVideos,getArtist,getPlaylist,getVideo}); |
{ | ||
"name": "ipman-youtube-music", | ||
"description": "Unofficial YouTube Music API for Node.js", | ||
"version": "0.12.5", | ||
"version": "0.12.6", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "exports": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66884
244