Skip to content

Commit

Permalink
try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Achaak committed Jun 27, 2023
1 parent 2baae90 commit e1ce61a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
17 changes: 10 additions & 7 deletions src/services/API/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@ export const API_ITEM_ENDPOINT = 'item/v8/';
export const AUTH_BY_EMAIL_ENDPOINT = 'auth/v3/authByEmail';
export const AUTH_POLLING_ENDPOINT = 'auth/v3/authByRequestPollingId';
export const REFRESH_ENDPOINT = 'auth/v3/token/refresh';
export const USER_AGENT = "TGTG/22.5.5 Dalvik/2.1.0 (Linux; Android 12; SM-G920V Build/MMB29K)";
export const DEVICE_TYPE = "ANDROID";
export const USER_AGENT = "TooGoodToGo/21.9.0 (813) (iPhone/iPhone 7 (GSM); iOS 15.1; Scale/2.00)";
export const DEVICE_TYPE = "IOS";

export const api = gotScraping.extend({
prefixUrl: BASE_URL,
headers: {
"User-Agent": USER_AGENT,
"Content-Type": "application/json; charset=utf-8",
Accept: "application/json",
"Accept-Language": "en-UK",
"Accept-Language": "en-US",
"Accept-Encoding": "gzip",
},
responseType: "json",
retry: {
limit: 2,
methods: ["GET", "POST", "PUT", "HEAD", "DELETE", "OPTIONS", "TRACE"],
statusCodes: [401, 403, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
},
// @ts-ignore
headerGeneratorOptions: {
browsers: [
{
name: "chrome",
},
{ name: "safari" },
],
devices: ["mobile"],
locales: ["en-US"],
operatingSystems: ["android"],
operatingSystems: ["ios"],
},
});
1 change: 0 additions & 1 deletion src/services/API/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const refresh = ({ refreshToken }: { refreshToken: string }) =>
refresh_token: string;
}>(REFRESH_ENDPOINT, {
json: {
device_type: DEVICE_TYPE,
refresh_token: refreshToken,
},
});
14 changes: 12 additions & 2 deletions src/services/API/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ export const getFavorite = ({
latitude: 48.85332,
longitude: 2.34885,
},
radius: 200,
radius: 21,
user_id: userId,
device_type: DEVICE_TYPE,
page_size: 20,
page: 1,
discover: false,
item_categories: [],
diet_categories: [],
pickup_earliest: null,
pickup_latest: null,
search_phrase: null,
with_stock_only: false,
hidden_only: false,
we_care_only: false,
},
headers: {
Authorization: `Bearer ${accessToken}`,
Expand Down

0 comments on commit e1ce61a

Please sign in to comment.