diff --git a/src/consts.ts b/src/consts.ts index e69de29..4f193ca 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -0,0 +1,6 @@ +export const GRAPHQL_ENDPOINT = 'https://www.threads.net/api/graphql'; +export const THREADS_APP_ID = '238260118697367'; + +export const ENDPOINTS_DOCUMENT_ID = { + USER_PROFILE: '23996318473300828' +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 53a4e39..c552897 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,14 @@ -fetch ('https://www.threads.net/api/graphql', { +import { ENDPOINTS_DOCUMENT_ID, GRAPHQL_ENDPOINT, THREADS_APP_ID } from "./consts"; + +fetch (GRAPHQL_ENDPOINT, { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko)', - 'x-ig-app-id':'238260118697367' + 'x-ig-app-id': THREADS_APP_ID }, - body: 'variables={ "userID": "8242141302" }&doc_id=23996318473300828' + body: `variables={ "userID": "8242141302" }&doc_id=${ENDPOINTS_DOCUMENT_ID.USER_PROFILE}` }) .then(res => res.json()) .then(res => console.log(res)) \ No newline at end of file