谁拿到就喜欢上Instagram的特定媒体用户的列表 [英] Get a list of users who have liked specific media on Instagram

查看:169
本文介绍了谁拿到就喜欢上Instagram的特定媒体用户的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Instagram的API,我需要得到谁已经喜欢特定媒体用户的列表



以下调用应该根据文档返回所有用户的列表: https://api.instagram.com/v1/media/555 /喜欢?=的access_token ACCESS-TOKEN



不过,我得到的只有120个用户,没有分页参数。


$ b $ 2 b

有什么办法,以保持请求休息



如果您需要的代码:

 字符串requestLikes =htt​​ps://api.instagram.com/v1/media/+ mediaID +/喜欢的access_token =?+ +的access_token与&计数= 0; 
//创建的URL请求。
=请求WebRequest.Create(requestLikes);
//得到响应。
响应= request.GetResponse();
//剩余通话
AddOrUpdateAppSettings(remainingCalls,response.Headers [X-Ratelimit-剩余]);
//显示状态。
Console.WriteLine(((HttpWebResponse)响应).StatusDescription);
//获取服务器返回包含流内容。
数据流= response.GetResponseStream();
//打开使用容易获得一个StreamReader流。
=读者新的StreamReader(数据流);
//读取内容。
responseFromServer = reader.ReadToEnd();


解决方案

不幸的是他们只提供newest-最新120喜欢以悠久的无分页顺序。您可以通过请求照片,然后喜欢它测试这个,你会看到你的帐户上名列榜首。



唯一的解决办法是建立一个作业定期缓存喜欢开始后不久的照片先贴。因为你总是得到最新的120你可以让他们所有的方式。您可以创建一个订阅使用实时API用户,并得到一个ping时,您的用户发布一个新的照片,然后开始喜欢缓存。腐烂的速度会建议 - 也许缓存的第一个小时几次它的发布后,再少频繁它已经长


Using Instagram API I need to get a list of users who have liked specific media.

The following call should return the list of all users according to the documentation: https://api.instagram.com/v1/media/555/likes?access_token=ACCESS-TOKEN

However, I get only 120 users with no pagination parameters.

Is there any way to keep requesting the rest?

If you need the code:

String requestLikes = "https://api.instagram.com/v1/media/" + mediaID + "/likes?access_token=" + access_token + "&count=0";
        // Create a request for the URL. 
        request = WebRequest.Create(requestLikes);
        // Get the response.
        response = request.GetResponse();
        //Remaining calls
        AddOrUpdateAppSettings("remainingCalls", response.Headers["X-Ratelimit-Remaining"]);
        // Display the status.
        Console.WriteLine(((HttpWebResponse)response).StatusDescription);
        // Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream();
        // Open the stream using a StreamReader for easy access.
        reader = new StreamReader(dataStream);
        // Read the content.
        responseFromServer = reader.ReadToEnd();

解决方案

Unfortunately they only provide the latest 120 likes in newest-to-oldest order with no pagination. You can test this by requesting a photo then liking it and you'll see that your account is on top of the list.

The only work around is to set up a job to periodically cache likes beginning shortly after the photo is first posted. Since you're always getting the newest 120 you can get them all that way. You can create a subscription to a user using the realtime api and get a ping when your user posts a new photo, then start caching likes. A decaying rate would be advised - maybe cache a couple times the first hour after it's posted, then less and less frequently the longer it's been.

这篇关于谁拿到就喜欢上Instagram的特定媒体用户的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆