This commit is contained in:
Aria Blue
2024-02-11 01:58:04 -05:00
parent 228a62208a
commit 1761fab9fa
3 changed files with 11 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ import {
function headers(oauthToken?: string | undefined): HeadersInit {
const headers: HeadersInit = DEFAULT_HEADERS
if (oauthToken) headers['Authorization'] = 'OAuth ' + oauthToken;
if (oauthToken) headers['Authorization'] = 'OAuth ' + oauthToken
return headers
}
@@ -38,7 +38,7 @@ export default class Soundcloud implements Streamer {
hostnames = ['soundcloud.com', 'm.soundcloud.com', 'www.soundcloud.com']
oauthToken?: string
constructor(options: SoundcloudOptions) {
this.oauthToken = options.oauthToken;
this.oauthToken = options.oauthToken
}
async search(query: string, limit = 20): Promise<SearchResults> {
const client = await this.#getClient()
@@ -151,7 +151,12 @@ export default class Soundcloud implements Streamer {
return {
type: 'track',
getStream: async () => {
return await getStream(api.media.transcodings, api.track_authorization, client, this.oauthToken)
return await getStream(
api.media.transcodings,
api.track_authorization,
client,
this.oauthToken
)
},
metadata: await parseTrack(api)
}