mirror of
https://codeberg.org/lucida/lucida.git
synced 2026-11-12 14:47:24 -05:00
format
plz
This commit is contained in:
@@ -80,7 +80,10 @@ export default class Deezer implements StreamerWithLogin {
|
||||
if (options?.arl) this.#loginViaArl(options.arl)
|
||||
}
|
||||
|
||||
async #apiCall<T extends keyof APIMethod>(method: T, data: { [key: string]: string | number | string[] } = {}): Promise<APIMethod[T]> {
|
||||
async #apiCall<T extends keyof APIMethod>(
|
||||
method: T,
|
||||
data: { [key: string]: string | number | string[] } = {}
|
||||
): Promise<APIMethod[T]> {
|
||||
let apiToken = this.apiToken
|
||||
if (method == 'deezer.getUserData' || method == 'user.getArl') apiToken = ''
|
||||
|
||||
@@ -92,10 +95,10 @@ export default class Deezer implements StreamerWithLogin {
|
||||
cid: Math.floor(Math.random() * 1e9).toString()
|
||||
})}`
|
||||
|
||||
interface DeezerResponse {
|
||||
results: APIMethod[T];
|
||||
error: number[] | { [key: string]: string }
|
||||
}
|
||||
interface DeezerResponse {
|
||||
results: APIMethod[T]
|
||||
error: number[] | { [key: string]: string }
|
||||
}
|
||||
|
||||
const body = JSON.stringify(data)
|
||||
const req = await fetch(url, { method: 'POST', body, headers: this.headers })
|
||||
@@ -111,7 +114,7 @@ export default class Deezer implements StreamerWithLogin {
|
||||
const sid = setCookie.match(/sid=(fr[0-9a-f]+)/)![1]
|
||||
this.headers['Cookie'] += `arl=${this.arl}; sid=${sid}`
|
||||
|
||||
const res = <APIMethod['deezer.getUserData']>results
|
||||
const res = <APIMethod['deezer.getUserData']>results
|
||||
|
||||
this.apiToken = res.checkForm
|
||||
this.licenseToken = res.USER?.OPTIONS?.license_token
|
||||
|
||||
@@ -8,40 +8,46 @@ export enum DeezerFormat {
|
||||
}
|
||||
|
||||
export interface DeezerLoginResponse {
|
||||
error?: {
|
||||
type: string
|
||||
message: string
|
||||
}
|
||||
error?: {
|
||||
type: string
|
||||
message: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DeezerMediaResponse {
|
||||
data: [{
|
||||
media: [{
|
||||
sources: [{
|
||||
url: string
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
data: [
|
||||
{
|
||||
media: [
|
||||
{
|
||||
sources: [
|
||||
{
|
||||
url: string
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export interface DeezerUserData {
|
||||
USER: {
|
||||
USER_ID: number
|
||||
EXPLICIT_CONTENT_LEVEL: string
|
||||
OPTIONS: {
|
||||
license_token: string
|
||||
web_hq: boolean
|
||||
web_lossless: boolean
|
||||
}
|
||||
SETTING: {
|
||||
global: {
|
||||
language: string
|
||||
}
|
||||
}
|
||||
OPTIONS: {
|
||||
license_token: string
|
||||
web_hq: boolean
|
||||
web_lossless: boolean
|
||||
}
|
||||
SETTING: {
|
||||
global: {
|
||||
language: string
|
||||
}
|
||||
}
|
||||
}
|
||||
OFFER_ID: number
|
||||
COUNTRY: string
|
||||
checkForm: string
|
||||
checkForm: string
|
||||
}
|
||||
|
||||
export interface DeezerArtist {
|
||||
|
||||
Reference in New Issue
Block a user