From 718f3db98da6b523411f7932082e8cd5e08b857d Mon Sep 17 00:00:00 2001 From: "alterwain@protonmail.com" Date: Sat, 8 Feb 2025 11:49:27 +0300 Subject: [PATCH 1/4] modified: Cargo.toml modified: src/main.rs --- Cargo.toml | 3 +++ src/main.rs | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 38c0cd9..9841ede 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,9 @@ authors = ["alterwain"] keywords = ["api", "network", "audio", "music"] categories = ["network-programming", "asynchronous", "api", "music", "audio"] +[lib] +crate-type = ["staticlib", "cdylib", "lib"] + [dependencies] reqwest = { version = "0.12.12", features = ["json"] } tokio = { version = "1.43.0", features = ["full"] } diff --git a/src/main.rs b/src/main.rs index 9c1f501..2dadd3e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,17 +9,13 @@ mod sobjects; const CHROME_USER_AGENT: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"; const SOUNDCLOUD_API_DOMAIN: &str = "api-v2.soundcloud.com"; const SOUNDCLOUD_DOMAIN: &str = "https://soundcloud.com"; -/* -[lib] -crate-type = ["staticlib", "cdylib", "lib"] -*/ // version: 1738322252 // likes: https://api-v2.soundcloud.com/users/774639751/likes?client_id=zFEmsF1cEZZQ92nRRXKOg7e6ibFR1L7c&limit=10&offset=0&linked_partitioning=1&app_version=1734537250&app_locale=en // playlists: https://api-v2.soundcloud.com/users/774639751/playlists_without_albums?client_id=zFEmsF1cEZZQ92nRRXKOg7e6ibFR1L7c&limit=10&offset=0&linked_partitioning=1&app_version=1734537250&app_locale=en -#[tokio::main] +/*#[tokio::main] async fn main() -> Result<(), Box> { let app_version = get_app().await.unwrap().unwrap(); let client_id = get_client_id().await.unwrap().unwrap(); @@ -28,7 +24,7 @@ async fn main() -> Result<(), Box> { println!("Playlists: {:#?}", get_playlists(user_id, client_id, app_version).await.unwrap()); Ok(()) -} +}*/ async fn get_likes(user_id: u64, client_id: String, app_version: String) -> Result, Box> { let client = reqwest::Client::new(); From e5d3306bf7fb44c5bb8fd8089b0a092da3a634df Mon Sep 17 00:00:00 2001 From: "alterwain@protonmail.com" Date: Sat, 8 Feb 2025 11:54:01 +0300 Subject: [PATCH 2/4] renamed: src/main.rs -> src/lib.rs --- src/{main.rs => lib.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{main.rs => lib.rs} (100%) diff --git a/src/main.rs b/src/lib.rs similarity index 100% rename from src/main.rs rename to src/lib.rs From 3c29b0714f9b1a8f3060748e60716101b83d12f0 Mon Sep 17 00:00:00 2001 From: "alterwain@protonmail.com" Date: Sat, 8 Feb 2025 12:05:58 +0300 Subject: [PATCH 3/4] modified: src/lib.rs --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2dadd3e..f4aca2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,7 @@ async fn main() -> Result<(), Box> { Ok(()) }*/ -async fn get_likes(user_id: u64, client_id: String, app_version: String) -> Result, Box> { +pub async fn get_likes(user_id: u64, client_id: String, app_version: String) -> Result, Box> { let client = reqwest::Client::new(); let resp = client.get(format!("https://{}/users/{}/likes?client_id={}&limit=10&offset=0&linked_partitioning=1&app_version={}&app_locale=en", SOUNDCLOUD_API_DOMAIN, user_id, client_id, app_version) ) @@ -39,7 +39,7 @@ async fn get_likes(user_id: u64, client_id: String, app_version: String) -> Resu Ok(Some(resp)) } -async fn get_playlists(user_id: u64, client_id: String, app_version: String) -> Result> { +pub async fn get_playlists(user_id: u64, client_id: String, app_version: String) -> Result> { let client = reqwest::Client::new(); let resp = client.get(format!("https://{}/users/{}/playlists_without_albums?client_id={}&limit=10&offset=0&linked_partitioning=1&app_version={}&app_locale=en", SOUNDCLOUD_API_DOMAIN, user_id, client_id, app_version)) @@ -54,7 +54,7 @@ async fn get_playlists(user_id: u64, client_id: String, app_version: String) -> Ok(playlists) } -async fn get_app() -> Result, Box> { +pub async fn get_app() -> Result, Box> { let client = reqwest::Client::new(); let resp = client.get(format!("{}/versions.json", SOUNDCLOUD_DOMAIN)) @@ -79,7 +79,7 @@ async fn get_app() -> Result, Box> { ) } -async fn get_client_id() -> Result, Box> { +pub async fn get_client_id() -> Result, Box> { let client = reqwest::Client::new(); let resp = client.get(format!("{}/soundcloud", SOUNDCLOUD_DOMAIN)) From d4d51c64e9225763f6d40a7f450c673ab6e36ddf Mon Sep 17 00:00:00 2001 From: "alterwain@protonmail.com" Date: Sat, 8 Feb 2025 12:07:31 +0300 Subject: [PATCH 4/4] modified: src/lib.rs --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f4aca2e..c43327b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ use regex::Regex; use reqwest::header::{HOST, ORIGIN, REFERER, USER_AGENT}; use sobjects::CloudPlaylists; -mod sobjects; +pub mod sobjects; const CHROME_USER_AGENT: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"; const SOUNDCLOUD_API_DOMAIN: &str = "api-v2.soundcloud.com";