Skip to content

Commit

Permalink
Add GraphQL endpoint and constants
Browse files Browse the repository at this point in the history
  • Loading branch information
dvque committed Jan 31, 2024
1 parent 71424fb commit 551d2ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/consts.ts
Original file line number Diff line number Diff line change
@@ -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'
}
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 551d2ee

Please sign in to comment.