From 1803afcbabb0fcc577d236cff16a396e2b861722 Mon Sep 17 00:00:00 2001 From: aria Date: Mon, 29 Jul 2024 14:59:09 -0400 Subject: [PATCH] format and lint --- src/streamers/deezer/main.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/streamers/deezer/main.ts b/src/streamers/deezer/main.ts index fc0eef4..e123c98 100644 --- a/src/streamers/deezer/main.ts +++ b/src/streamers/deezer/main.ts @@ -152,16 +152,15 @@ export default class Deezer implements StreamerWithLogin { } async login(username: string, password: string): Promise { - if (this.arl) { - await this.#loginViaArl(this.arl) - } else { + if (this.arl) await this.#loginViaArl(this.arl) + else { const resp = await fetch('https://www.deezer.com/', { headers: this.headers }) const setCookie = resp.headers.get('Set-Cookie') ?? '' const sid = setCookie.match(/sid=(fr[0-9a-f]+)/)![1] this.headers['Cookie'] = `sid=${sid}` - + password = this.#md5(password) - + const loginReq = await fetch( `https://connect.deezer.com/oauth/user_auth.php?${new URLSearchParams({ app_id: CLIENT_ID, @@ -172,9 +171,9 @@ export default class Deezer implements StreamerWithLogin { { headers: this.headers } ) const { error } = await loginReq.json() - + if (error) throw new Error('Error while getting access token, check your credentials') - + const arl = await this.#apiCall('user.getArl') await this.#loginViaArl(arl) }