threads-api
threads-api copied to clipboard
How are we obtaining the `x-fb-lsd` token?
Hi,
I am copying these calls into a Java client.
How can we obtain the 'x-fb-lsd' token?
Thanks
Hi @nasty-nick-tv! We obtain the token by parsing the HTML doc.
This logic is inside both getUserIDfromUsername and getPostIDfromURL. We use it to update the token each time those methods are called.
https://github.com/junhoyeo/threads-api/blob/c86f4d8506520d677dccc86c64470dc18b02dc54/threads-api/src/threads-api.ts#L194-L203
Best of luck with your client! I would greatly appreciate it if you could reference my work here (Rest assured, I'll do the same for you in this project's README.md).
Question, how do we get fbLSDToken for ThreadsAPI options?
Question, how do we get
fbLSDTokenfor ThreadsAPI options?
Hi, @Digital39999! Currently, this library threads-api only supports reading data from Threads. fbLSDToken is the value used in GraphQL requests to Threads.
- You don't need to set
fbLSDTokenmanually. The package includes an default value you can use without zero setup, and updates internal state automatically when it requests to raw doc. You can just initializeThreadsAPIwith empty options:
const threadsAPI = new ThreadsAPI()
- If you still want to set
fbLSDTokenyourself, you can retrieve it in your own way using the upper code snippet I added to answer @nasty-nick-tv's question, and pass like the following:
const threadsAPI = new ThreadsAPI({
fbLSDToken,
noUpdateLSD: true /* default is `false`, if you want to fix `fbLSDToken` with your provided value, set to `true` */
})`
Ah thank you for information, are there any rate-limits you occurred yet? It seems that it starts redirecting after too many requests, which isn't ideal, could you add a handler for that?
Also noUpdateLSD is in method options, not in class constructor.
Added custom proxy options in #32 to sort of prevent this from happening.
Also
noUpdateLSDis in method options, not in class constructor.
Oops, my bad. Should've fixed this.