youtube-music

Crates.ioyoutube-music
lib.rsyoutube-music
version2.3.0
sourcesrc
created_at2022-10-03 17:50:56.99247
updated_at2024-08-17 11:59:06.409435
descriptionA library for fetching Youtube Music metadata
homepage
repositoryhttps://github.com/jakubslaby09/rust-ytmapi
max_upload_size
id679209
size27,612
Jakub Slabý (jakubslaby09)

documentation

README

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);
Commit count: 52

cargo fmt