Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipman-youtube-music

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipman-youtube-music - npm Package Compare versions

Comparing version 0.12.4 to 0.12.5

2

dist/index.js

@@ -1,1 +0,1 @@

"use strict";var se=Object.create;var h=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var ae=(e,t)=>{for(var r in t)h(e,r,{get:t[r],enumerable:!0})},w=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of oe(t))!ue.call(e,s)&&s!==r&&h(e,s,{get:()=>t[s],enumerable:!(n=ie(t,s))||n.enumerable});return e};var b=(e,t,r)=>(r=e!=null?se(le(e)):{},w(t||!e||!e.__esModule?h(r,"default",{value:e,enumerable:!0}):r,e)),me=e=>w(h({},"__esModule",{value:!0}),e);var Ie={};ae(Ie,{AccountType:()=>E,AlbumType:()=>I,GetMusicVideoBasedSuggestions:()=>j,ListMusicVideosFromAlbum:()=>K,ListMusicVideosFromPlaylist:()=>Z,PageType:()=>v,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||{}),v=(n=>(n.artist="MUSIC_PAGE_TYPE_ARTIST",n.album="MUSIC_PAGE_TYPE_ALBUM",n.playlist="MUSIC_PAGE_TYPE_PLAYLIST",n))(v||{});var g="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"}},f=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=f(e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs)}catch{}let s;try{let{length:u}=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs;s={name:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[u-3].text,id:e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[u-3].navigationEndpoint.browseEndpoint?.browseId}}catch{}let i;try{i=e.musicResponsiveListItemRenderer.thumbnail.musicThumbnailRenderer.thumbnail.thumbnails.pop()?.url}catch{}let a;try{let u=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs.length-1].text;a={label:u,totalSeconds:x(u)}}catch{}let l;try{l=e.musicResponsiveListItemRenderer.badges[0].musicInlineBadgeRenderer.icon.iconType===g}catch{l=!1}return{youtubeId:t,title:r,artists:n,album:s,thumbnailUrl:i,duration:a,isExplicit:l}},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=f(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 l;try{l={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:l}},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 l=[];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}),l.push(p))})}catch(o){console.error(o)}let u;try{let o=e.twoColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicResponsiveHeaderRenderer;u={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:l,author:u}},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=f(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 l;try{l=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===g}catch{l=!1}return{youtubeId:t,title:r,artists:n,album:s,thumbnailUrl:i,duration:a,isExplicit:l}},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 l;try{l=e.musicResponsiveListItemRenderer.flexColumns[1].musicResponsiveListItemFlexColumnRenderer.text.runs[4].text}catch(o){console.error("Couldn't parse year",o)}let u;try{u=e.musicResponsiveListItemRenderer?.badges[0].musicInlineBadgeRenderer.icon.iconType===g}catch{u=!1}return{albumId:t,title:r,type:n,thumbnailUrl:s,artist:i,artistId:a,year:l,isExplicit:u}},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===g}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(l){console.error("Couldn't get title",l)}let r;try{r=L(e.musicTwoRowItemRenderer.subtitle.runs[0].text)}catch(l){console.error("Couldn't get album type",l)}let n;try{n=e.musicTwoRowItemRenderer.title.runs[0].navigationEndpoint.browseEndpoint.browseId}catch(l){console.error("Couldn't get albumId",l)}let s;try{s=e.musicTwoRowItemRenderer.subtitle.runs.pop()?.text}catch(l){console.error("Couldn't get year",l)}let i;try{i=e.musicTwoRowItemRenderer.subtitleBadges[0].musicInlineBadgeRenderer.icon.iconType===g}catch{i=!1}let a;try{a=e.musicTwoRowItemRenderer.thumbnailRenderer.musicThumbnailRenderer.thumbnail.thumbnails.shift()?.url}catch(l){console.error("Couldn't get thumbnailUrl",l)}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(i){console.error("Couldn't get subscribers",i)}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 l=[];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{l.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 u=[],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):u.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 C;try{C=e.header.musicImmersiveHeaderRenderer.subscriptionButton?.subscribeButtonRenderer.subscriberCountWithSubscribeText.runs[0].text}catch{}return{artistId:t,name:r,description:n,albums:u,singles:o,thumbnails:s,songsPlaylistId:i,suggestedArtists:p,subscribers:C,songs:a,videos:l}},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(i){console.error("Couldn't get subscribers",i)}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"}});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"}});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"}});return Re(t.data)}catch(t){return console.error(t),[]}}var z=b(require("axios"));var ge=(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"}});try{return ge(r.data,t?.onlyOfficialPlaylists??!1)}catch(n){return console.error(n),[]}}var Y=b(require("axios")),he=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"}});try{return he(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 l=B(a);l&&(l.album=i,l.artists?.length===0&&(l.artists=[{name:s}]),l.thumbnailUrl=n,r.push(l))}catch(l){console.error(l)}}),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"}});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"}});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"}});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"}});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"}});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 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});
{
"name": "ipman-youtube-music",
"description": "Unofficial YouTube Music API for Node.js",
"version": "0.12.4",
"version": "0.12.5",
"private": false,

@@ -6,0 +6,0 @@ "exports": "./dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc