mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-10 05:39:38 +05:00
API and many small fixes
This commit is contained in:
46
docs/API.md
Normal file
46
docs/API.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Check enabled features
|
||||
|
||||
Just go to `/_/info` endpoint
|
||||
|
||||
# API
|
||||
|
||||
To make use of it, instance must have API enabled of course. Currently, there is only one functionality present. If you are working on some cool project and wanna have more functionality here, let me know
|
||||
|
||||
## Searching
|
||||
|
||||
You can search with endpoint `/_/api/search`. Query parameters are:
|
||||
- `q`: the query
|
||||
- `type`: `users`, `tracks`, or `playlists`. Required
|
||||
- `pagination`: raw parameters to pass into soundcloud's api
|
||||
|
||||
The response is in JSON format. To go to next page, take the `next_href` from result, strip away everything until `?`, and pass that as `pagination` parameter.
|
||||
|
||||
For example: `/_/api/search?q=test&type=tracks` to search for `tracks` named `test`
|
||||
|
||||
# Other automation
|
||||
|
||||
Doesn't require API to be enabled
|
||||
|
||||
## Download songs
|
||||
|
||||
Restream must be enabled in the instance. The endpoint is `/_/restream/<author permalink>/<track permalink>`. Query parameters are:
|
||||
- `metadata`: `true` or `false`. If `true`, soundcloak will inject metadata (author, track cover, track title, etc) into the audio file, but this may take a little bit more time
|
||||
- `audio`: `best`, `aac`, `opus`, or `mpeg`. [Read more here](AUDIO_PRESETS.md)
|
||||
|
||||
For example: `/_/restream/lucybedroque/speakers?metadata=true&audio=opus` to get the `opus` audio with `metadata` for song `speakers` by author `lucybedroque`
|
||||
|
||||
## Get search suggestions
|
||||
|
||||
The endpoint is `/_/searchSuggestions`. Query parameters are:
|
||||
- `q`: the query
|
||||
|
||||
The response is a list of search suggestions as strings in JSON format.
|
||||
|
||||
For example: `/_/searchSuggestions?q=hi` to get search suggestions for `hi`
|
||||
|
||||
## Proxy images
|
||||
|
||||
ProxyImages must be enabled in the instance.
|
||||
|
||||
Endpoint for images: `/_/proxy/images`. Put image url into `url` query parameter. Of course, this only proxies images from soundcloud cdn
|
||||
|
||||
@@ -117,9 +117,10 @@ Some notes:
|
||||
| PlaylistCacheCleanDelay | PLAYLIST_CACHE_CLEAN_DELAY | 5 minutes | Time between each cleanup of the cache (to remove expired playlists) |
|
||||
| UserAgent | USER_AGENT | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.3 | User-Agent header used for requests to SoundCloud |
|
||||
| DNSCacheTTL | DNS_CACHE_TTL | 60 minutes | Time until DNS cache expires |
|
||||
| EnableAPI | ENABLE_API | false | Should [API](API.md) be enabled? |
|
||||
| Network | NETWORK | tcp4 | Network to listen on. Can be tcp4, tcp6 or unix |
|
||||
| Addr | ADDR | :4664 | Address and port (or socket path) for soundcloak to listen on |
|
||||
| UnixSocketPerms | UNIX_SOCKET_PERMS | 0775 | Permissions for unix socket (Network must be set to unix) on |
|
||||
| UnixSocketPerms | UNIX_SOCKET_PERMS | 0775 | Permissions for unix socket (Network must be set to unix) |
|
||||
| Prefork | PREFORK | false | Run multiple instances of soundcloak locally to be able to handle more requests. Each one will be a separate process, so they will have separate cache. |
|
||||
| TrustedProxyCheck | TRUSTED_PROXY_CHECK | true | Use X-Forwarded-* headers if IP is in TrustedProxies list. When disabled, those headers will blindly be used. |
|
||||
| TrustedProxies | TRUSTED_PROXIES | [] | List of IPs or IP ranges of trusted proxies |
|
||||
@@ -170,7 +171,7 @@ To get listed on [the instance list](https://maid.zone/soundcloak/instances.html
|
||||
Basic rules:
|
||||
|
||||
1. Do not collect user information (either yourself, or by including 3rd party tooling which does that)
|
||||
2. If you are modifying the source code, publish those changes somewhere. Even if it's just static files, it would be best to publish those changes somewhere.
|
||||
2. If you are modifying the source code, publish those changes somewhere.
|
||||
|
||||
Also, keep in mind that the instance list will periodically hit the `/_/info` endpoint on your instance (usually each 10 minutes) in order to display the instance settings. If you do not want this to happen, state it in your discussion/message, and I will exclude your instance from this checking.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user