Get list of images from Instagram for explicit user account

拈花ヽ惹草 提交于 2019-12-14 03:07:35

问题


I've google for several hours now and I haven't found a suitable solution to my "problem". My previous solution was to use an url like this for fetching json-data of images related to my Instagram account.

https://www.instagram.com/[account-name-here]/media

For some reason this url doesn't work any more (404?). Perhaps Instagram has done some changes on their side.

That in mind I've searched for an alternative solution, with no luck.

I'm super exited to hear if any of you guys can point me in the right direction.

And ... I'm using C# :-)


回答1:


You can create a client i have an example here

 public async Task<object> GetMediaInfo(string mediaId)
        {
            string clientId = "YOUR_CLIENT_ID";
            string clientSecret = "YOUR_CLIENT_SECRET";
            string accessToken = "A_VALID_ACCESS_TOKEN";
            InstagramClient client = new InstagramClient(clientId,clientSecret);
            var media = await client.MediaEndpoints.GetMediaInfoAsync(mediaId, accessToken);
            //I use Json.NET for parsing the result
            var mediaJson = JsonConvert.DeserializeObject(media);
            //You can deserialize json result to one of the models in InstagramCSharp or to your custom model
            //var mediaJson = JsonConvert.DeserializeObject<Envelope<Media>>(mediaJson);

            return mediaJson;
        }   
    }



回答2:


you can try this

https://www.instagram.com/USERID/?__a=1

it is working with me :)



来源:https://stackoverflow.com/questions/47238978/get-list-of-images-from-instagram-for-explicit-user-account

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!