SoundCloudExplode 1.3.8
See the version list below for details.
dotnet add package SoundCloudExplode --version 1.3.8
NuGet\Install-Package SoundCloudExplode -Version 1.3.8
<PackageReference Include="SoundCloudExplode" Version="1.3.8" />
paket add SoundCloudExplode --version 1.3.8
#r "nuget: SoundCloudExplode, 1.3.8"
// Install SoundCloudExplode as a Cake Addin #addin nuget:?package=SoundCloudExplode&version=1.3.8 // Install SoundCloudExplode as a Cake Tool #tool nuget:?package=SoundCloudExplode&version=1.3.8
<h1 align="center"> SoundCloudExplode </h1>
<p align="center"> <a href="https://discord.gg/mhxsSMy2Nf"><img src="https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white"></a> <a href="https://github.com/jerry08/SoundCloudExplode"><img src="https://img.shields.io/nuget/dt/SoundCloudExplode.svg?label=Downloads&color=%233DDC84&logo=nuget&logoColor=%23fff&style=for-the-badge"></a> </p>
SoundCloudExplode is a library that provides an interface to query metadata of SoundCloud tracks and playlists, as well as to resolve and download streams.
πSTAR THIS REPOSITORY TO SUPPORT THE DEVELOPER AND ENCOURAGE THE DEVELOPMENT OF THE APPLICATION!
Install
- π¦ NuGet:
dotnet add package SoundCloudExplode
(main package)
Usage
SoundCloudExplode exposes its functionality through a single entry point β the SoundCloudClient
class.
Create an instance of this class and use the provided operations to send requests.
Tracks
Retrieving track metadata
To retrieve the metadata associated with a Soundcloud track, call Tracks.GetAsync(...)
:
using SoundCloudExplode;
var soundcloud = new SoundCloudClient();
var track = await soundcloud.Tracks.GetAsync("https://soundcloud.com/purityy79/dororo-op-piano-sheet-in-description");
var title = track.Title;
var duration = track.Duration;
Playlists
Retrieving playlist metadata
You can get the metadata associated with a Soundcloud playlist by calling Playlists.GetAsync(...)
method:
using SoundCloudExplode;
var soundcloud = new SoundCloudClient();
//Get playlist info with all tracks
var playlist = await soundcloud.Playlists.GetAsync(
"https://soundcloud.com/tommy-enjoy/sets/aimer"
);
//Or Get only the playlist basic info without loading all tracks info
var playlist = await soundcloud.Playlists.GetAsync(
"https://soundcloud.com/tommy-enjoy/sets/aimer",
false
);
var title = playlist.Title;
var artworkUrl = playlist.ArtworkUrl;
var tracks = playlist.Tracks;
...
Getting tracks included in a playlist
To get the tracks included in a playlist, call Playlists.GetTracksAsync(...)
:
using SoundCloudExplode;
using SoundCloudExplode.Common;
var soundcloud = new SoundCloudClient();
// Get all tracks in a playlist
var tracks = await soundcloud.Playlists.GetTracksAsync(
"https://soundcloud.com/tommy-enjoy/sets/aimer"
);
// Get only the first 20 playlist tracks
var tracksSubset = await soundcloud.Playlists
.GetTracksAsync("https://soundcloud.com/tommy-enjoy/sets/aimer")
.CollectAsync(20);
// OR
var tracksSubset = await soundcloud.Playlists
.GetTracksAsync(
"https://soundcloud.com/tommy-enjoy/sets/aimer",
limit: 20
);
//Setting offset
var tracksSubset = await soundcloud.Playlists
.GetTracksAsync(
"https://soundcloud.com/tommy-enjoy/sets/aimer",
offset: 10,
limit: 5
);
You can also enumerate the tracks iteratively without waiting for the whole list to load:
using SoundCloudExplode;
var soundcloud = new SoundCloudClient();
await foreach (var track in soundcloud.Playlists.GetTracksAsync(
"https://soundcloud.com/tommy-enjoy/sets/aimer"
))
{
var title = track.Title;
var duration = track.Duration;
}
If you need precise control over how many requests you send to Soundcloud, use Playlists.GetTrackBatchesAsync(...)
which returns tracks wrapped in batches:
using SoundCloudExplode;
var soundcloud = new SoundCloudClient();
// Each batch corresponds to one request
await foreach (var batch in soundcloud.Playlists.GetTrackBatchesAsync(
"https://soundcloud.com/tommy-enjoy/sets/aimer"
))
{
foreach (var track in batch.Items)
{
var title = track.Title;
var duration = track.Duration;
}
}
Albums
Note: Use the same method as retrieving playlists to get albums because they are the same.
Searching
You can execute a search query and get its results by calling Search.GetResultsAsync(...). Each result may represent either a track, a playlist, an album, or a user, so you need to apply pattern matching to handle the corresponding cases:
using SoundCloudExplode;
var soundcloud = new SoundCloudClient();
await foreach (var result in soundcloud.Search.GetResultsAsync("banda neira"))
{
// Use pattern matching to handle different results (tracks, playlists, users)
switch (result)
{
case TrackSearchResult track:
{
var id = track.Id;
var title = track.Title;
var duration = track.Duration;
break;
}
//NOTE: Soundcloud handles playlist and albums the same way.
case PlaylistSearchResult playlist:
{
var id = playlist.Id;
var title = playlist.Title;
break;
}
case UserSearchResult user:
{
var id = user.Id;
var title = user.Title;
var userName = user.Username;
var fullName = user.FullName;
break;
}
}
}
Downloading tracks
using System;
using System.IO;
using SoundCloudExplode;
var soundcloud = new SoundCloudClient();
var track = await soundcloud.GetAsync("https://soundcloud.com/purityy79/dororo-op-piano-sheet-in-description");
var trackName = string.Join("_", track.Title.Split(Path.GetInvalidFileNameChars()));
await soundcloud.DownloadAsync(track, $@"{Environment.CurrentDirectory}\Download\{trackName}.mp3");
You can request the download url for a particular track by calling Tracks.GetDownloadUrlAsync(...)
:
using SoundCloudExplode;
var soundcloud = new SoundCloudClient();
var track = await soundcloud.Tracks.GetAsync("https://soundcloud.com/purityy79/dororo-op-piano-sheet-in-description");
var downloadUrl = await soundcloud.Tracks.GetDownloadUrlAsync(
track
);
This project was inspired by YoutubeExplode.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- HtmlAgilityPack (>= 1.11.46)
- Newtonsoft.Json (>= 13.0.2)
-
.NETFramework 4.6.1
- HtmlAgilityPack (>= 1.11.46)
- Microsoft.Bcl.AsyncInterfaces (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.2)
- System.Text.Json (>= 6.0.7)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
.NETStandard 2.0
- HtmlAgilityPack (>= 1.11.46)
- Microsoft.Bcl.AsyncInterfaces (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.2)
- System.Text.Json (>= 6.0.7)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
.NETStandard 2.1
- HtmlAgilityPack (>= 1.11.46)
- Newtonsoft.Json (>= 13.0.2)
- System.Text.Json (>= 6.0.7)
-
net5.0
- HtmlAgilityPack (>= 1.11.46)
- Newtonsoft.Json (>= 13.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on SoundCloudExplode:
Repository | Stars |
---|---|
jerry08/Yosu
Downloads videos, tracks and playlists from YouTube, Soundcloud and Spotify
|
Version | Downloads | Last updated |
---|---|---|
1.6.5 | 543 | 8/30/2024 |
1.6.4 | 358 | 7/13/2024 |
1.6.3 | 163 | 6/22/2024 |
1.6.2 | 300 | 6/14/2024 |
1.6.1 | 107 | 6/10/2024 |
1.6.0 | 92 | 6/10/2024 |
1.5.3 | 1,135 | 9/1/2023 |
1.5.1 | 204 | 8/18/2023 |
1.5.0 | 542 | 7/26/2023 |
1.4.2 | 210 | 6/9/2023 |
1.4.1 | 260 | 4/25/2023 |
1.4.0 | 298 | 3/21/2023 |
1.3.9 | 237 | 3/12/2023 |
1.3.8 | 271 | 2/13/2023 |
1.3.5 | 301 | 1/18/2023 |
1.3.4 | 307 | 1/6/2023 |