mirror of
https://codeberg.org/lucida/lucida.git
synced 2026-11-17 00:57:25 -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)
|
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
|
let apiToken = this.apiToken
|
||||||
if (method == 'deezer.getUserData' || method == 'user.getArl') 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()
|
cid: Math.floor(Math.random() * 1e9).toString()
|
||||||
})}`
|
})}`
|
||||||
|
|
||||||
interface DeezerResponse {
|
interface DeezerResponse {
|
||||||
results: APIMethod[T];
|
results: APIMethod[T]
|
||||||
error: number[] | { [key: string]: string }
|
error: number[] | { [key: string]: string }
|
||||||
}
|
}
|
||||||
|
|
||||||
const body = JSON.stringify(data)
|
const body = JSON.stringify(data)
|
||||||
const req = await fetch(url, { method: 'POST', body, headers: this.headers })
|
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]
|
const sid = setCookie.match(/sid=(fr[0-9a-f]+)/)![1]
|
||||||
this.headers['Cookie'] += `arl=${this.arl}; sid=${sid}`
|
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.apiToken = res.checkForm
|
||||||
this.licenseToken = res.USER?.OPTIONS?.license_token
|
this.licenseToken = res.USER?.OPTIONS?.license_token
|
||||||
|
|||||||
@@ -8,40 +8,46 @@ export enum DeezerFormat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DeezerLoginResponse {
|
export interface DeezerLoginResponse {
|
||||||
error?: {
|
error?: {
|
||||||
type: string
|
type: string
|
||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeezerMediaResponse {
|
export interface DeezerMediaResponse {
|
||||||
data: [{
|
data: [
|
||||||
media: [{
|
{
|
||||||
sources: [{
|
media: [
|
||||||
url: string
|
{
|
||||||
}]
|
sources: [
|
||||||
}]
|
{
|
||||||
}]
|
url: string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeezerUserData {
|
export interface DeezerUserData {
|
||||||
USER: {
|
USER: {
|
||||||
USER_ID: number
|
USER_ID: number
|
||||||
EXPLICIT_CONTENT_LEVEL: string
|
EXPLICIT_CONTENT_LEVEL: string
|
||||||
OPTIONS: {
|
OPTIONS: {
|
||||||
license_token: string
|
license_token: string
|
||||||
web_hq: boolean
|
web_hq: boolean
|
||||||
web_lossless: boolean
|
web_lossless: boolean
|
||||||
}
|
}
|
||||||
SETTING: {
|
SETTING: {
|
||||||
global: {
|
global: {
|
||||||
language: string
|
language: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OFFER_ID: number
|
OFFER_ID: number
|
||||||
COUNTRY: string
|
COUNTRY: string
|
||||||
checkForm: string
|
checkForm: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeezerArtist {
|
export interface DeezerArtist {
|
||||||
|
|||||||
Reference in New Issue
Block a user