#api-wrapper #music #streaming #youtube #bandcamp #search-query #platform

musicou-kit

An unofficial API wrapper for music streaming sites like Youtube Music, Soundcloud and Bandcamp

11 releases

0.1.2 Aug 30, 2023
0.1.1 Aug 30, 2023
0.0.9 Aug 29, 2023
0.0.3 Jul 29, 2023

#1901 in Web programming

AGPL-3.0

59KB
1.5K SLoC

musicou-kit

Musicou-kit is an API wrapper for Youtube Music, SoundCloud and Bandcamp. It's fairly straight forward to use and easy to implement into other applications.

Current state

This crate is still experimental & WIP and will significantly change in the future. It has very messy code and some bugs and only support one(1) platform for now..

Examples

Search with a query and get the first artist and fetch its data.

#[tokio::main]
async fn main() {
    env_logger::init(); // logs stuff
    // crating search with query and defining platform
    let mut search = Search::new("the weeknd" structs::Platform::Youtube)
        .fetch(structs::Page::Artist) // fetching a certain page
        .await;

    // fetching all data for first artist in search results
    print!(" {:?}, ", search.unwrap().artists.unwrap()[0].fetch().await)
    // Ok(Artist { id: "UClYV6hHlupm_S_ObS1W-DYw", name: "The Weeknd", platform: Youtube, thumbnails: [Thumbnail { url: ".....", width: 540, height: 225 }], background: [], incomplete: true, followers: 33000000 }
}

Getting song data from id

#[tokio::main]
async fn main() {
    env_logger::init(); // logs stuff
    let song = Song::from_id("diW6jXhLE0E").fetch().await;
    println!("{:?}", song.unwrap());
    // Song { id: "", title: "The Weeknd - Party Monster (Official Video)", length: 258, author: Artist { id: "", name: "", platform: Youtube, thumbnails: [], background: [], incomplete: true, followers: 0, private_field: "" }, thumbnails: [Thumbnail { url: "https://i.ytimg.com/.....", width: 400, height: 225 } ... ], view_count: 154341745, streams: Some([Stream { url: "https://rr3---....", bitrate: "130477", mime_type: "audio/mp4; codecs="mp4a.40.2" } ]), album: None, type_of: Youtube, incomplete: false}
}

Roadmap

  • Youtube scraping / extracting

    • Stream extraction
    • Music
    • Search
      • Songs
      • Albums
      • Playlists
      • Artists
    • Albums
    • Artist
    • Playlist
  • Soundcloud scraping

    • Stream extraction
    • Direct music lookup
    • Searh
    • Albums
    • Artist
    • Playlist
  • Bandcamp scraping

    • Stream extraction
    • Direct music lookup
    • Search
    • Albums
    • Artist
    • Playlist

Thanks <3!

Youtube internal api research

Dependencies

~13–31MB
~452K SLoC