
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
youtube-moosick
Advanced tools
Unofficial YouTube Music Library, written in TypeScript.
import { YoutubeMoosick } from "youtube-moosick";
const ytms = new YoutubeMoosick.new();
// Using async await
const results = await ytms.search("Never gonna give you up");
console.log(results);
/*
ContinuableUnsorted(16) [
Video {
thumbnails: [ [Object] ],
name: 'Never Gonna Give You Up',
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
videoId: 'dQw4w9WgXcQ',
author: [ [Artist] ],
views: 1000,
length: 213000
},
Song {
type: 'SONG',
artist: [ [Artist] ],
album: [ [Album] ],
duration: 214000,
name: 'Never Gonna Give You Up',
url: 'https://www.youtube.com/watch?v=lYBUbBu4W08',
videoId: 'lYBUbBu4W08',
thumbnails: [ [Object], [Object] ],
playlistId: 'RDAMVMlYBUbBu4W08',
params: 'wAEB'
},
// ...
]
*/
npm i youtube-moosick
search
▸ search(query
, searchType?
): Promise
<unknown
>
Searches YouTube Music.
Name | Type | Default value | Description |
---|---|---|---|
query | string | undefined | String query text to search |
searchType? | Category | undefined | Type of category to search |
The return of this function depends on the supplied value of searchType
.
Category | Return Type |
---|---|
undefined | Promise <ContinuableUnsorted > |
Category.SONG | Promise <ContinuableResult <Song> > |
Category.VIDEO | Promise <ContinuableResult <Video> > |
Category.ALBUM ,Category.SINGLE ,Category.EP | Promise <ContinuableResult <Album> > |
Category.ARTIST | Promise <ContinuableResult <ArtistExtended> > |
Category.PLAYLIST | Promise <ContinuableResult <Playlist> > |
For more info, see here.
const ytms = await YoutubeMoosick.new();
// Get the general search results.
const resultsGeneral = await ytms.search('Never gonna give you up');
console.log(resultsGeneral)
/*
ContinuableUnsorted(16) [
Video {
thumbnails: [ [Object] ],
name: 'Never Gonna Give You Up',
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
videoId: 'dQw4w9WgXcQ',
author: [ [Artist] ],
views: 1000,
length: 213000
},
Song {
type: 'SONG',
artist: [ [Artist] ],
album: [ [Album] ],
duration: 214000,
name: 'Never Gonna Give You Up',
url: 'https://www.youtube.com/watch?v=lYBUbBu4W08',
videoId: 'lYBUbBu4W08',
thumbnails: [ [Object], [Object] ],
playlistId: 'RDAMVMlYBUbBu4W08',
params: 'wAEB'
},
// ...
]
*/
// Gets a specific category
const resultsSong = await ytms.search('Never gonna give you up', Category.SONG);
console.log(resultsSong)
/*
ContinuableResult(20) [
Song {
type: 'SONG',
artist: [ [Artist] ],
album: [ [Album] ],
duration: 214000,
name: 'Never Gonna Give You Up',
url: 'https://www.youtube.com/watch?v=lYBUbBu4W08',
videoId: 'lYBUbBu4W08',
thumbnails: [ [Object], [Object] ],
playlistId: 'RDAMVMlYBUbBu4W08',
params: 'wAEB'
},
Song {
type: 'SONG',
artist: [ [Artist] ],
album: [ [Album] ],
duration: 267000,
name: 'Never Gonna Give You Up (Rick Astley)',
url: 'https://www.youtube.com/watch?v=4ywFyK8cCg4',
videoId: '4ywFyK8cCg4',
thumbnails: [ [Object], [Object] ],
playlistId: 'RDAMVM4ywFyK8cCg4',
params: 'wAEB'
},
....
]
*/
getSearchSuggestions
▸ getSearchSuggestions(query
): Promise
<SearchSuggestions
[]>
Fetches search suggestions from YouTube Music.
Name | Type | Description |
---|---|---|
query | string | String query text to search |
Promise
<SearchSuggestions
[]>
An object containing data gotten from the search.
const suggestions = ytms.getSearchSuggestions("All We know");
console.log(suggestions);
/*
[
SearchSuggestions { artist: '', title: 'all we know' },
SearchSuggestions { artist: ' chainsmokers lyrics', title: 'all we know'},
SearchSuggestions { artist: ' shy', title: 'all we know' },
SearchSuggestions { artist: ' slowed', title: 'all we know' },
SearchSuggestions { artist: ' remix', title: 'all we know' },
SearchSuggestions { artist: ' nightcore', title: 'all we know' },
SearchSuggestions { artist: ' paramore', title: 'all we know' }
]
*/
getAlbum
▸ getAlbum(browseId
): Promise
<AlbumURL
>
Fetches album details from YouTube Music.
Name | Type | Description |
---|---|---|
browseId | string | The album Id only, without https://.... |
Promise
<AlbumURL
>
An object containing data of the Album requested.
const ytms = await YoutubeMoosick.new();
const results = await ytms.getAlbum('MPREb_REsMMqBZjZB');
console.log(results)
/*
AlbumURL {
AlbumURLHeader: AlbumURLHeader {
title: 'Eyes wide open',
description: `Eyes Wide Open is the second Korean studio album by South Korean girl group Twice. It was released on
October 26, 2020, by JYP Entertainment and Republic Records. It is the group's first ...",
date: '2020',
thumbnails: [ [Object], [Object], [Object], [Object] ],
trackCount: 13,
totalRuntime: '43 minutes',
artist: [ [Artist] ]
},
tracks: [
Track {
lengthMs: 206000,
title: "I CAN'T STOP ME",
videoId: 'CM4CkVFmTds',
playlistId: 'OLAK5uy_nGyCX4aNigDzsvNSRZ63NPiH75wef3lCw',
url: 'https://www.youtube.com/watch?v=CM4CkVFmTds'
},
Track {
lengthMs: 180000,
title: 'HELL IN HEAVEN',
videoId: '0O18GnTW1CU',
playlistId: 'OLAK5uy_nGyCX4aNigDzsvNSRZ63NPiH75wef3lCw',
url: 'https://www.youtube.com/watch?v=0O18GnTW1CU'
},
Track {
lengthMs: 215000,
title: 'UP NO MORE',
videoId: 'Qgylz1pLFE0',
playlistId: 'OLAK5uy_nGyCX4aNigDzsvNSRZ63NPiH75wef3lCw',
url: 'https://www.youtube.com/watch?v=Qgylz1pLFE0'
},
....
]
}
*/
getArtist
▸ getArtist(browseId
): Promise
<ArtistURL
>
Fetches artist details from YouTube Music.
Name | Type | Description |
---|---|---|
browseId | string | The artist browseId only, without https://.... |
Promise
<ArtistURL
>
An object containing data of the Artist requested.
const ytms = await YoutubeMoosick.new();
const results = await ytms.getArtist('UCAq0pFGa2w9SjxOq0ZxKVIw');
console.log(results);
/*
ArtistURL {
headers: ArtistHeader {
artistName: 'TWICE',
description: 'Twice, commonly stylized as TWICE, is a South Korean girl grou
p formed by JYP Entertainment. The group is composed of nine members: Nayeon, Je
ongyeon, Momo, Sana, Jihyo, Mina, Dahyun, Chaeyoung, and Tzuyu. Twice was ...',
totalSubscribers: '11.5M',
thumbnails: [ [Thumbnails], [Thumbnails] ]
},
artistContents: ArtistContent {
albums: [
[Albums], [Albums],
[Albums], [Albums],
[Albums], [Albums],
[Albums], [Albums],
[Albums], [Albums]
],
single: [
[Single], [Single],
[Single], [Single],
[Single], [Single],
[Single], [Single],
[Single], [Single]
],
videos: [
[Videos], [Videos],
[Videos], [Videos],
[Videos], [Videos],
[Videos], [Videos],
[Videos], [Videos]
]
}
}
*/
getPlaylist
▸ getPlaylist(browseId
, contentLimit?
): Promise
<PlaylistURL
>
Fetches playlist details from YouTube Music.
Name | Type | Default value | Description |
---|---|---|---|
browseId | string | undefined | The playlist browseId only, without https://.... |
contentLimit | number | 100 | Maximum amount of contents to get, defaults to 100 |
Promise
<PlaylistURL
>
An object containing data of the Playlist requested.
const ytms = await YoutubeMoosick.new();
const results = await ytms.getPlaylist('PLXs921kKn8XT5_bq5kR2gQ_blPZ7DgyS1');
console.log(results);
/*
PlaylistURL {
headers: PlaylistHeader {
playlistName: 'The Chainsmokers - All We Know ft. Phoebe Ryan',
owner: 'Jakub Gabryš',
createdYear: 2021,
thumbnail: [ [Object], [Object], [Object] ],
songCount: 38,
approxRunTime: '1+ hours'
},
playlistContents: [
{
trackTitle: 'All We Know (feat. Phoebe Ryan)',
trackId: 'lEi_XBg2Fpk',
artist: [Array],
thumbnail: [Array]
},
{
trackTitle: 'The Chainsmokers ft. Phoebe Ryan : All We Know - Lyrics',
trackId: '4kNcLZ3kcZg',
artist: [Array],
thumbnail: [Array]
},
...
],
continuation: {
continuation: '4qmFsgIwEiRWTFBMWHM5MjFrS244WFQ1X2JxNWtSMmdRX2J************
GtnRURDTTBH',
clickTrackingParams: 'CBIQybcCIhMI1KHIoI7E8gIVC8***********'
}
}
*/
getAlbumBrowseId
▸ getAlbumBrowseId(listID
): Promise
<string
>
Gets the browseId
for the album based on the newer listID
Name | Type | Description |
---|---|---|
listID | string | The listID of the album |
Promise
<string
>
String The browseID
of the album
Example:
const api = await MooSick.new();
const results = await api.getAlbumBrowseId('OLAK5uy_ljhFMBuzqiynvNq_3dC2QhQaz12zkD0LE');
console.log(results);
Tests are written in tape
npm run test
These tests are real life tests, they actually run a query to simulate a real life situation.
All contributions are welcome. File an issue if you find something wrong, & a pull request if you can fix it.
FAQs
Unofficial Youtube music API, fully written in TypeScript
The npm package youtube-moosick receives a total of 1 weekly downloads. As such, youtube-moosick popularity was classified as not popular.
We found that youtube-moosick demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.