recycleactor commited on
Commit
d7ba09d
·
verified ·
1 Parent(s): 5e6c312

Upload 2 files

Browse files
Files changed (2) hide show
  1. src/api.rs +11 -1
  2. src/main.rs +9 -1
src/api.rs CHANGED
@@ -104,7 +104,9 @@ impl APIClient {
104
  check_form = &self.check_form;
105
  }
106
 
107
- let json: DeezerResponse = self.client.post("https://www.deezer.com/ajax/gw-light.php")
 
 
108
  .query(&[
109
  ("method", method),
110
  ("input", "3"),
@@ -112,6 +114,14 @@ impl APIClient {
112
  ("api_token", check_form)
113
  ])
114
  .header(ACCEPT, "*/*")
 
 
 
 
 
 
 
 
115
  .json(params)
116
  .send()
117
  .await?
 
104
  check_form = &self.check_form;
105
  }
106
 
107
+ let json: DeezerResponse = self
108
+ .client
109
+ .post("https://www.deezer.com/ajax/gw-light.php")
110
  .query(&[
111
  ("method", method),
112
  ("input", "3"),
 
114
  ("api_token", check_form)
115
  ])
116
  .header(ACCEPT, "*/*")
117
+ .header("Origin", "https://www.deezer.com")
118
+ .header("Referer", "https://www.deezer.com/")
119
+ .header("X-Requested-With", "XMLHttpRequest")
120
+ .header("Accept-Language", "en-US,en;q=0.9")
121
+ .header(
122
+ "User-Agent",
123
+ "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
124
+ )
125
  .json(params)
126
  .send()
127
  .await?
src/main.rs CHANGED
@@ -391,6 +391,14 @@ async fn gw_light_call(
391
  ("api_token", api_token),
392
  ])
393
  .header(ACCEPT, "*/*")
 
 
 
 
 
 
 
 
394
  .json(&params)
395
  .send()
396
  .await
@@ -422,7 +430,7 @@ async fn login(Json(req): Json<LoginReq>) -> impl IntoResponse {
422
  .build()
423
  .unwrap();
424
 
425
- let ud = match gw_light_call(&client, "deezer.getUserData", "null", json!({})).await {
426
  Ok(v) => v,
427
  Err(e) => return json_error(StatusCode::BAD_GATEWAY, e),
428
  };
 
391
  ("api_token", api_token),
392
  ])
393
  .header(ACCEPT, "*/*")
394
+ .header("Origin", "https://www.deezer.com")
395
+ .header("Referer", "https://www.deezer.com/")
396
+ .header("X-Requested-With", "XMLHttpRequest")
397
+ .header("Accept-Language", "en-US,en;q=0.9")
398
+ .header(
399
+ "User-Agent",
400
+ "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
401
+ )
402
  .json(&params)
403
  .send()
404
  .await
 
430
  .build()
431
  .unwrap();
432
 
433
+ let ud = match gw_light_call(&client, "deezer.getUserData", "", json!({})).await {
434
  Ok(v) => v,
435
  Err(e) => return json_error(StatusCode::BAD_GATEWAY, e),
436
  };