https://github.com/s-frei/tracksearch
Search on YouTube and/or SoundCloud for tracks and get their metadata
https://github.com/s-frei/tracksearch
expose http-client java metadata-extraction music search search-interface song soundcloud stream youtube
Last synced: 9 months ago
JSON representation
Search on YouTube and/or SoundCloud for tracks and get their metadata
- Host: GitHub
- URL: https://github.com/s-frei/tracksearch
- Owner: s-frei
- License: apache-2.0
- Created: 2020-05-11T18:51:23.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2024-10-02T04:13:03.000Z (over 1 year ago)
- Last Synced: 2025-07-04T20:21:10.610Z (11 months ago)
- Topics: expose, http-client, java, metadata-extraction, music, search, search-interface, song, soundcloud, stream, youtube
- Language: Java
- Homepage:
- Size: 927 KB
- Stars: 12
- Watchers: 3
- Forks: 5
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## What is it ?
*TrackSearch* is for searching track metadata on different sources, like *YouTube* and *SoundCloud* for now.
**Note:** TrackSearch isn't using any API-Key, it uses the public API (like your browser).
## Supported sources
Since TrackSearch focuses on searching for music (although YouTube offers more than music)
I decided to add following providers for now:


There could be more added if there are interesting sources to go for.
#### Current features :mag_right:
- search
- paging
- multiple clients asynchronous
- metadata like: duration, channel, views, thumbnail, ...
## Stream
With release [1.0.0](https://github.com/s-frei/TrackSearch/releases/tag/1.0.0) the capability of getting all available
audio formats and the actual stream URL was removed, as it takes too much effort to maintain it and there are other
*huge* projects that offer that with a large community like [yt-dlp](https://github.com/yt-dlp/yt-dlp).
To get the stripped functionality back use e.g.:
```shell
yt-dlp -J | jq '.formats | map(select(.vcodec == "none"))'
```
I decided against implementing a simple wrapper to bring back the stripped functionalities as usage will differ
from user to user.
## How to use it ? :books:
### Dependency
*TrackSearch* is available on [Maven Central](https://search.maven.org/artifact/io.sfrei/tracksearch):
```xml
io.sfrei
tracksearch
1.0.0
```
```kotlin
implementation("io.sfrei:tracksearch:1.0.0")
```
on [GitHub Packages](https://github.com/s-frei/TrackSearch/packages) or directly from
[GitHub Releases](https://github.com/s-frei/TrackSearch/releases/latest).
### Getting started
```java
// Client to search on all available sources asynchronous
MultiTrackSearchClient searchClient = new MultiSearchClient();
// Client for explicit source
TrackSearchClient explicitClient = new SoundCloudClient();
try {
TrackList tracksForSearch = searchClient.getTracksForSearch("");
Track track = tracksForSearch.get(0);
final String url = track.getUrl();
final String title = track.getTitle();
final Duration duration = track.getDuration();
final TrackMetadata trackMetadata = track.getTrackMetadata();
final String channelName = trackMetadata.channelName();
final String channelUrl = trackMetadata.channelUrl();
final String thumbNailUrl = trackMetadata.thumbNailUrl();
final Long streamAmount = trackMetadata.streamAmount();
// Get next tracks page
TrackList nextTracks = tracksForSearch.next();
// Get a track for URL
SoundCloudTrack trackForUrl = explicitClient.getTrack("");
} catch (TrackSearchException e) {
// Damn
}
```
For more information check the related interface documentation or have a look into the
[tests](https://github.com/s-frei/TrackSearch/blob/develop/src/test/java/io/sfrei/tracksearch/clients/ClientTest.java).
## Why is this done ?
I haven't found anything which is capable of doing this kind of stuff, except it offered something similar and could be
abused for this, or it wasn't written in Java.
## Develop :hammer:
**Note:** **JDK 17** is required! (`sdk env install`)
Fire up following in your shell:
#### Build
```sh
$ ./mvnw clean install
```
#### Test
The *simple* [test runs daily](https://github.com/s-frei/TrackSearch/actions) to get notified when something is not
working. Test it on your own:
```sh
$ ./mvnw test
```
For detailed test (about ~250 tracks for each client):
```sh
$ ./mvnw test -P detailed-client-test
```
---
## Contributing :handshake:
Feel free to contribute! - [How?](https://github.com/s-frei/TrackSearch/blob/develop/CONTRIBUTING.md)