Loading more Instagram comments and likes

925 Views Asked by At

Task. Load more comments and likes.

Description. I'm using: query_hash=f0986789a5c5d17c2400faebf16efd0d for comments
query_hash=e0f59e4a1c8d78d0161873bc2ee7ec44 for likes.

There are 3 variables in a query: 1. "shortcode". Always the same for my case. 2. "first". A number of appropriate items. 3. "after".

PL - Java.

Issue.

Where can I get the initial and following value for "after" variable?

Thanks

2

There are 2 best solutions below

0
andrea-f On

You don't need the after key in the variables dict. Initial value you can specify whatever you want but the maximum number of edges returned per query is 50.

0
Alexey On

The "after" is cursor position, initially it is NULL or can be omited and in next request can be obtained for the previous response:

data.shortcode_media.edge_liked_by.page_info.end_cursor

A sample:

{
    "data": {
        "shortcode_media": {
            "id": "XXX",
            "shortcode": "YYY",
            "edge_liked_by": {
                "count": 2029,
                "page_info": {
                    "has_next_page": true,
                    "end_cursor": "QVFCSi1hR01ZZExCVk1TZFRfUzluSmJZZGwy..."
                },
            }
        }
    },
    "status": "ok"
}