modified: Cargo.lock

modified:   Cargo.toml
	modified:   src/main.rs
	modified:   src/sobjects.rs
This commit is contained in:
Michael Wain 2025-02-09 22:30:25 +03:00
parent 17e3f8881e
commit 0d3769dcc3
4 changed files with 13 additions and 14 deletions

2
Cargo.lock generated
View File

@ -1036,7 +1036,7 @@ dependencies = [
[[package]] [[package]]
name = "soundcloud" name = "soundcloud"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"hyper-util", "hyper-util",
"regex", "regex",

View File

@ -1,12 +1,15 @@
[package] [package]
name = "soundcloud" name = "soundcloud"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
description = "A small rust crate for fetching data from soundcloud without developer account" description = "A small rust crate for fetching data from soundcloud without developer account"
authors = ["alterwain"] authors = ["alterwain"]
keywords = ["api", "network", "audio", "music"] keywords = ["api", "network", "audio", "music"]
categories = ["network-programming", "asynchronous", "api", "music", "audio"] categories = ["network-programming", "asynchronous", "api", "music", "audio"]
[lib]
crate-type = ["staticlib", "cdylib", "lib"]
[dependencies] [dependencies]
reqwest = { version = "0.12.12", features = ["json"] } reqwest = { version = "0.12.12", features = ["json"] }
tokio = { version = "1.43.0", features = ["full"] } tokio = { version = "1.43.0", features = ["full"] }

View File

@ -4,22 +4,18 @@ use regex::Regex;
use reqwest::header::{HOST, ORIGIN, REFERER, USER_AGENT}; use reqwest::header::{HOST, ORIGIN, REFERER, USER_AGENT};
use sobjects::CloudPlaylists; 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 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_API_DOMAIN: &str = "api-v2.soundcloud.com";
const SOUNDCLOUD_DOMAIN: &str = "https://soundcloud.com"; const SOUNDCLOUD_DOMAIN: &str = "https://soundcloud.com";
/*
[lib]
crate-type = ["staticlib", "cdylib", "lib"]
*/
// version: 1738322252 // 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 // 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 // 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<dyn std::error::Error>> { async fn main() -> Result<(), Box<dyn std::error::Error>> {
let app_version = get_app().await.unwrap().unwrap(); let app_version = get_app().await.unwrap().unwrap();
let client_id = get_client_id().await.unwrap().unwrap(); let client_id = get_client_id().await.unwrap().unwrap();
@ -28,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Playlists: {:#?}", get_playlists(user_id, client_id, app_version).await.unwrap()); println!("Playlists: {:#?}", get_playlists(user_id, client_id, app_version).await.unwrap());
Ok(()) Ok(())
} }*/
async fn get_likes(user_id: u64, client_id: String, app_version: String) -> 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 client = reqwest::Client::new(); let client = reqwest::Client::new();

View File

@ -1,9 +1,9 @@
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize, Clone)]
pub struct CloudPlaylists { pub struct CloudPlaylists {
pub collection: Vec<CloudPlaylist> pub collection: Vec<CloudPlaylist>
} }
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize, Clone)]
pub struct CloudPlaylist { pub struct CloudPlaylist {
pub artwork_url: Option<String>, pub artwork_url: Option<String>,
pub description: String, pub description: String,
@ -16,7 +16,7 @@ pub struct CloudPlaylist {
pub tracks: Vec<CloudTrack> pub tracks: Vec<CloudTrack>
} }
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize, Clone)]
pub struct CloudTrack { pub struct CloudTrack {
pub artwork_url: Option<String>, pub artwork_url: Option<String>,
pub created_at: Option<String>, pub created_at: Option<String>,
@ -30,12 +30,12 @@ pub struct CloudTrack {
pub media: Option<CloudTranscodings> pub media: Option<CloudTranscodings>
} }
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize, Clone)]
pub struct CloudTranscodings { pub struct CloudTranscodings {
pub transcodings: Vec<CloudTranscoding> pub transcodings: Vec<CloudTranscoding>
} }
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize, Clone)]
pub struct CloudTranscoding { pub struct CloudTranscoding {
pub duration: u32, pub duration: u32,
pub preset: String, pub preset: String,