modified: Cargo.lock

modified:   Cargo.toml
	modified:   src/main.rs
This commit is contained in:
Michael Wain 2025-02-04 07:16:20 +03:00
parent f9914523bc
commit 2a569f96e7
3 changed files with 53 additions and 21 deletions

47
Cargo.lock generated
View File

@ -791,9 +791,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "reqwest"
version = "0.12.9"
version = "0.12.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f"
checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da"
dependencies = [
"base64",
"bytes",
@ -824,6 +824,7 @@ dependencies = [
"system-configuration",
"tokio",
"tokio-native-tls",
"tower",
"tower-service",
"url",
"wasm-bindgen",
@ -951,18 +952,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.216"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.216"
version = "1.0.217"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
dependencies = [
"proc-macro2",
"quote",
@ -971,9 +972,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.133"
version = "1.0.138"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949"
dependencies = [
"itoa",
"memchr",
@ -1037,6 +1038,7 @@ dependencies = [
name = "soundcloud"
version = "0.1.0"
dependencies = [
"hyper-util",
"regex",
"reqwest",
"serde",
@ -1139,9 +1141,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.42.0"
version = "1.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551"
checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
dependencies = [
"backtrace",
"bytes",
@ -1157,9 +1159,9 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "2.4.0"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
@ -1199,6 +1201,27 @@ dependencies = [
"tokio",
]
[[package]]
name = "tower"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [
"futures-core",
"futures-util",
"pin-project-lite",
"sync_wrapper",
"tokio",
"tower-layer",
"tower-service",
]
[[package]]
name = "tower-layer"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
[[package]]
name = "tower-service"
version = "0.3.3"

View File

@ -8,8 +8,9 @@ keywords = ["api", "network", "audio", "music"]
categories = ["network-programming", "asynchronous", "api", "music", "audio"]
[dependencies]
reqwest = { version = "0.12", features = ["json"] }
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.12.12", features = ["json"] }
tokio = { version = "1.43.0", features = ["full"] }
regex = "1.11.1"
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0.48"
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.138"
hyper-util = "0.1.10"

View File

@ -18,18 +18,26 @@ crate-type = ["staticlib", "cdylib", "lib"]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("{}", get_app().await.unwrap().unwrap());
let app_version = get_app().await.unwrap().unwrap();
let client_id = get_client_id().await.unwrap().unwrap();
let user_id: u64 = 774639751;
println!("Likes: {}", get_likes(user_id, client_id, app_version).await.unwrap().unwrap());
Ok(())
}
async fn get_likes() -> Result<Option<String>, Box<dyn Error>> {
async fn get_likes(user_id: u64, client_id: String, app_version: String) -> Result<Option<String>, Box<dyn Error>> {
let resp = reqwest::get(format!("https://api-v2.soundcloud.com/users/{}/likes?client_id={}&limit=10&offset=0&linked_partitioning=1&app_version={}&app_locale=en", user_id, client_id, app_version) )
.await?
.text()
.await?;
Ok(Some(resp))
}
async fn get_playlists() -> Result<Option<String>, Box<dyn Error>> {
/*async fn get_playlists() -> Result<Option<String>, Box<dyn Error>> {
}
}*/
async fn get_app() -> Result<Option<String>, Box<dyn Error>> {
let resp = reqwest::get("https://soundcloud.com/versions.json")