Instagram ?__a=1&max_id= isn't working for public user feeds

前端 未结 2 1574
终归单人心
终归单人心 2020-12-24 10:24

I\'ve been using Instagram\'s undocumented API https://www.instagram.com//?__a=1 to get a public user feed.

I was also able to get multiple

相关标签:
2条回答
  • 2020-12-24 10:41

    04-14-2018 - NO LONGER WORKING - INSTAGRAM DEPRECATED THE '?__a=1' & '?query_id=17888483320059182' - THIS NO LONGER WORKS!

    Okay take a look at this for media pagination:

    https://instagram.com/graphql/query/?query_id=17888483320059182&id=<user_id>&first=12&after=<end_cursor>

    This returns:

    ['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

    And Media:

    ['data']['user']['edge_owner_to_timeline_media']['edges']

    the 'query_id' is static now so just use: 17888483320059182

    'id' is the "instagram user id" so you have to use ?__a=1 to grab ['graphql']['user']['id']

    'first' is the number of photos you desire returned. Just use 12 to keep the media return the same.

    'after' is the new 'max_id' for use ['data']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

    I'll test more and respond later.

    Responding Later:

    It is believed 'pagination' using ?__a=1 has been deprecated. If true then there is no answer which can solve the op's direct question using ?__a=1 for Instagram pagination.

    But the code provided in this answer will provide the pagination of Instagram media which does provide the results the op was seeking.

    The answer incorporates the 'instagram graphql api' which is the current api (and not the json ?__a=1 hack) so this answer should provide some stability for now.

    As used on my live site:

    Grab the id=<instagram_user_id> prior the Instagram media request:

    profile = https://www.instagram.com/<instagram_username>/?__a=1

    media = https://instagram.com/graphql/query/?query_id=17888483320059182&id=<profile['graphql']['user']['id']>&first=12&after=<end_cursor>

    0 讨论(0)
  • 2020-12-24 10:50

    You can use this: ?__a=1&page=3

    0 讨论(0)
提交回复
热议问题