#music #youtube #javascript #artist

youtube-music

A library for fetching Youtube Music metadata

13 stable releases

2.2.0 Feb 9, 2024
2.1.1 Jan 17, 2024
2.1.0 Dec 27, 2023
2.0.0 Apr 16, 2023
1.1.0 Oct 6, 2022

#125 in Audio

Download history 3/week @ 2023-11-01 28/week @ 2023-11-08 1/week @ 2023-11-15 15/week @ 2023-11-22 25/week @ 2023-11-29 15/week @ 2023-12-06 14/week @ 2023-12-13 13/week @ 2023-12-20 51/week @ 2023-12-27 18/week @ 2024-01-03 2/week @ 2024-01-10 35/week @ 2024-01-17 1/week @ 2024-01-24 33/week @ 2024-01-31 33/week @ 2024-02-07 146/week @ 2024-02-14

214 downloads per month

MIT/Apache

26KB
445 lines

A library for fetching Youtube Music metadata

currently, these features are included:

  • searching for an artist by name
  • getting an artist's singles and albums
  • listing tracks and their ids from an album

this library was inspired by youtube-music-api written in javascript

Code examples

    // Request configs from youtube music
    let client = Client::init().await.unwrap();
    
    // Get an album from the first artist in the search results
    let album = client.search_artists("Tři sestry").await.unwrap()
    [0].request(&client).await.unwrap()
    .albums[0].request(&client).await.unwrap();
    
    println!("first album: {:#?}", album);
    // Request configs from youtube music
    let client = Client::init().await.unwrap();
    
    // Get an album from the first artist in the search results

    // Search for an artist
    let search_results = client.search_artists(QUERY).await.unwrap();

    // Get the first result
    let artist = client.get_artist(&search_results[0].browse_id).await.unwrap();

    // Get it's first album
    let album = client.get_album(&artist.albums[0].browse_id).await.unwrap();
    
    println!("first album: {:#?}", album);

Dependencies

~6–19MB
~273K SLoC