如何从InstaSharp中的Relationships端点访问UsersResponse中的分页?

时间:2013-10-28 09:01:28

标签: c# instagram instasharp

我有一个InstaSharp.Endpoints.Relationships.Authenticated对象EP_RELATIONSHIPS,我可以调用EP_RELATIONSHIPS.Follows()来获取我正在关注的用户列表。我跟踪了几百人,但我只得到50的结果。

当我使用API​​控制台检查Instagram API页面上的JSON数据时,我可以看到有一个分页URL。

其他返回对象(例如InstaSharp.Model.Responses.MediasResponse)有一个名为.Pagination的对象似乎提供此功能。

这个图书馆不完整吗?为什么Relationships端点响应中没有分页,如何在不重写自己版本的InstaSharp的这一部分的情况下完成分页?

3 个答案:

答案 0 :(得分:3)

最新版本的Instasharp(https://github.com/InstaSharp/InstaSharp)具有分页'在课堂上的财产。

还有一个分页实现用于在Tags.RecentMultiplePages(..)方法中返回库中的多个页面集,该方法将来可以更通用并推广到多个方法。 / p>

答案 1 :(得分:0)

您可以创建自己的具有分页的对象 - > next_url | next_cursor。从响应中获取json并将其反序列化为您自己的对象..

答案 2 :(得分:0)

要进一步澄清Damian's answer,如果查看InstaSharp github上的单元测试,可以看到如何使用分页的示例:

    public async Task Follows_NextCursor()
    {
        //This test will fail if testing with an account with less than one page of follows
        var result = await relationships.Follows();
        result = await relationships.Follows(457273003/*ffujiy*/, result.Pagination.NextCursor);
        Assert.IsTrue(result.Data.Count > 0);
    }
相关问题