Conversation
|
Hi there @krzesu0, thanks for the research! I've previously investigated Facebook's GraphQL endpoints quite extensively, and i know that the endpoint at data = {"id": <thread_id>, "first": 12}
j = self.graphql_request(_graphql.from_query_id("515216185516880", data))Note: This internal API was changed recently in #439, so remember to update from When you want to parse the result, please make a helper Regarding the cursors, then I think it'd be nice if we could hide them as an implementation detail, and just return an iterable, then the user can choose how many results they want from there? |
I rewrote this as @madsmtm suggested. I decided to hide cursor from user . Both |
madsmtm
left a comment
There was a problem hiding this comment.
In general, sorry I caused you so much trouble with the various merges, and thanks for the hard work!
|
I don't think this feature will work for thread videos, It returns only the preview URL and ID's. It uses these ID's to download it from |
> Use the attachment ID instead of the ID returned by the endpoint. > Use legacy_attachment_id instead of uid. And for some attachments, such as MessageAudio (which this endpoint also return), you won't even get an id! Co-Authored-By: Mads Marquart <madsmtm@gmail.com>
madsmtm
left a comment
There was a problem hiding this comment.
Nice work, I'll go ahead and merge this now! 🎉
Description
I wanted to create a way of downloading all images posted sent in given thread.
Research
I stareted by watching network traffic on
messenger.comwhile scrolling down the image history.First query looked like this:
https://www.messenger.com/webgraphql/query/?query_id=515216185516880&variables={"id":"<uid>","first":"<number>"}.Where uid is specified user and number is how many to download, default is 12. Facebook will do more, but I am kinda scared.If you scroll down further, it shows more and more history.
Query now looks like this:
https://www.messenger.com/webgraphql/query/?query_id=515216185516880&variables={"id":"<uid>","after":"<image_id>","first":<number>}. Previous variables are the same, but there is new thing calledafter, after digging around some more I found out that image_id is special variable for starting query after given image. It is called coursor in JSON.After POST'ing it, it returns almost readable JSON, it begins with "for (;;);".
My development
I forked it and created my own crude function to handle it. I'll keep working on it.