Skip to content

Explore

Helpers for the explore page.

Method Return Description
explore_page() dict Get the explore page payload
explore_page_media_info(media_pk) dict Get media metadata for an explore page item
report_explore_media(media_pk) bool Report a media on explore ("not interested" button)

Example:

>>> from aiograpi import Client
>>> cl = Client()
>>> await cl.login(USERNAME, PASSWORD)

>>> page = await cl.explore_page()

>>> media_pk = await cl.media_pk_from_url(
...     "https://www.instagram.com/p/ByU3LAslgWY/"
... )
>>> await cl.explore_page_media_info(media_pk)
{...}

>>> await cl.report_explore_media(media_pk)
True

Helpers for the explore page

Source code in aiograpi/mixins/explore.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class ExploreMixin:
    """
    Helpers for the explore page
    """

    async def explore_page(self):
        """
        Get explore page

        Returns
        -------
        dict
        """
        return await self.private_request("discover/topical_explore/")

    async def report_explore_media(self, media_pk: int):
        """
        Report media in explore page. This is equivalent to the "not interested" button

        Parameters
        ----------
        media_pk: int
            Media PK
        Returns
        -------
        bool
            True if success
        """
        params = {
            "m_pk": media_pk,
        }
        result = await self.private_request("discover/explore_report/", params=params)
        return result["explore_report_status"] == "OK"

    async def explore_page_media_info(self, media_pk: int):
        """
        Returns media information for a media item on the explore page

        This is the API call that happens when you're on the explore page
        and you click into a media item. It returns information about that media item
        like comments, likes, etc.
        """
        return (
            await self.private_request(
                "/v1/discover/media_metadata/", params={"media_id": media_pk}
            )
        )["media_or_ad"]

explore_page() async

Get explore page

Returns

dict

Source code in aiograpi/mixins/explore.py
 6
 7
 8
 9
10
11
12
13
14
async def explore_page(self):
    """
    Get explore page

    Returns
    -------
    dict
    """
    return await self.private_request("discover/topical_explore/")

explore_page_media_info(media_pk) async

Returns media information for a media item on the explore page

This is the API call that happens when you're on the explore page and you click into a media item. It returns information about that media item like comments, likes, etc.

Source code in aiograpi/mixins/explore.py
35
36
37
38
39
40
41
42
43
44
45
46
47
async def explore_page_media_info(self, media_pk: int):
    """
    Returns media information for a media item on the explore page

    This is the API call that happens when you're on the explore page
    and you click into a media item. It returns information about that media item
    like comments, likes, etc.
    """
    return (
        await self.private_request(
            "/v1/discover/media_metadata/", params={"media_id": media_pk}
        )
    )["media_or_ad"]

report_explore_media(media_pk) async

Report media in explore page. This is equivalent to the "not interested" button

Parameters

media_pk: int Media PK Returns


bool True if success

Source code in aiograpi/mixins/explore.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
async def report_explore_media(self, media_pk: int):
    """
    Report media in explore page. This is equivalent to the "not interested" button

    Parameters
    ----------
    media_pk: int
        Media PK
    Returns
    -------
    bool
        True if success
    """
    params = {
        "m_pk": media_pk,
    }
    result = await self.private_request("discover/explore_report/", params=params)
    return result["explore_report_status"] == "OK"