Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting html resp instead of json #1

Open
walmartwarlord opened this issue Jul 8, 2023 · 2 comments
Open

Getting html resp instead of json #1

walmartwarlord opened this issue Jul 8, 2023 · 2 comments

Comments

@walmartwarlord
Copy link

Is it normal that I get html response instead of json? Trying to paste this in the console

curl --request POST \
  --url https://www.threads.net/api/graphql \
  --header 'user-agent: threads-client' \
  --header 'x-ig-app-id: 238260118697367' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'variables={"userID":"314216"}' \
  --data doc_id=23996318473300828

gives me HTML response. Am I missing something? I already changed userID and doc_id etc but no luck

@jjhb94
Copy link

jjhb94 commented Jul 8, 2023

Look at the readme for the content type response. You want a header with a "header('Content-Type: application/json');" typically. In this case the response will ignore it since it doesn't know what you really want to do with json, and so the default returned will be html. Whenever you request json you typically need to then parse the object (call json.parse in code and pass in the object returned as a a parameter ). Otherwise you'll keep getting an html object

@surya-prakash-giri
Copy link

surya-prakash-giri commented Aug 7, 2023

@walmartwarlord, I was also facing the same issue, you can resolve it by providing the correct headers and request payload.

curl --location 'https://www.threads.net/api/graphql'
--header 'X-Fb-Friendly-Name: BarcelonaProfileRootQuery'
--header 'Origin: https://www.threads.net'
--header 'Content-Type: application/x-www-form-urlencoded'
--header 'X-Asbd-Id: 129477'
--header 'X-Fb-Lsd: api-token'
--header 'X-Ig-App-Id: 238260118697367'
--data-urlencode 'variables={"userID":"314216"}'
--data-urlencode 'doc_id=9943275619045977'
--data-urlencode 'lsd=api-token'

Threads
Say more with Threads — Instagram's new text app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants