How to get ALL Instagram POSTs by hashtag with the API (not only the posts of my own account)

前端 未结 2 2043
傲寒
傲寒 2021-02-05 22:47

How to get ALL Instagram POSTs by hashtag with the API (not only the posts of my own account)

I am trying to get all the instagram pictures tagged with

2条回答
  •  生来不讨喜
    2021-02-05 23:22

    You can get the posts in raw JSON by simply accessing this URL: https://www.instagram.com/explore/tags/summer/?__a=1

    Then just use javascript/jquery to fetch the data an loop through the posts. You get 12 posts, and a variable to see if there are more pages.

    Example of getting latest 6 posts:

    $.get('https://www.instagram.com/explore/tags/summer/?__a=1', function (data, status) {
        for(var i = 0; i < 6; i++) {
            var $this = data.graphql.hashtag.edge_hashtag_to_media.edges[i].node;
            $('#container').append('');
        }
    });
    

提交回复
热议问题