5 releases

new 0.2.3 Mar 18, 2025
0.2.2 Mar 18, 2025
0.2.1 Mar 18, 2025
0.2.0 Mar 18, 2025
0.1.0 Mar 17, 2025

#161 in Audio

Download history 326/week @ 2025-03-15

326 downloads per month

MIT license

76KB
1.5K SLoC

rsoundcloud

GitHub Actions Workflow Status License: MIT Crates.io Version

rsoundcloud is a Rust client library wrapping some of the internal v2 SoundCloud API (read/GET only methods). Does not require an API Key.

[!WARNING] This is NOT the official [SoundCloud developer API]

SoundCloud is not accepting application registration requests anymore. I made this library so developers can use SoundCloud's internal API for their projects.

Credits

This Rust crate is mostly a port of @7x11x13's python library; soundcloud-v2.

It is also inspired by the great rspotify crate.

Installation

Add the following to your Cargo.toml:

[dependencies]
rsoundcloud = "0.1.0"

Usage

Basic

Here's a basic example of how to fetch a track's details:

use rsoundcloud::SoundCloudClient;

#[tokio::main]
async fn main() {
    let client = SoundCloudClient::default();
    let track = client
        .get_track(ResourceId::Url("https://soundcloud.com/shmanii/beg-me-to-come-over".to_string()))
        .await;
    println!("{:#?}", track);
}

Authentication

Some endpoints require authentication. You must provide a SoundCloudClient with a valid OAuthToken to access these endpoints. You can also provide a custom client_id as the first argument to SoundCloudClient::new().

use rsoundcloud::{SoundCloudClient};

#[tokio::main]
async fn main() {
    let client = SoundCloudClient::new(
        Some("your_client_id".to_string()), 
        Some("your_oauth_token".to_string()
    ));
    let me = client.get_me().await;
    println!("{:#?}", me);
}

Here's the list of endpoints that require authentication:

  • get_me
  • get_my_history
  • get_my_streams
  • get_user_conversations
  • get_conversation_messages
  • get_unread_conversations
  • get_track_original_download_link

License

MIT License

Copyright (c) barthofu

Dependencies

~10–23MB
~313K SLoC