This commit is contained in:
Aria Blue 2024-02-11 01:58:04 -05:00
parent 228a62208a
commit 1761fab9fa
No known key found for this signature in database
GPG key ID: E851AE999FFCBC37
3 changed files with 11 additions and 5 deletions

View file

@ -9,6 +9,7 @@ export const DEFAULT_HEADERS = {
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Sec-GPC': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'
}
export const SC_VERSION = '1686222762'

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)
}

View file

@ -29,7 +29,7 @@ export interface RawArtist {
export interface Headers {
Authorization?: string
"User-Agent": string
'User-Agent': string
}
export function parseArtist(raw: RawArtist): Artist {