Instagram的API的Python用户后跟 [英] Instagram API python user followed by

查看:212
本文介绍了Instagram的API的Python用户后跟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用api.user_followed_by,它只能显示50个用户,则显示了所有用户,像一个链接<$c$c>\"https://api.instagram.com/v1/users/<id>/followed-by?access_token=<ACCESS-TOKEN>\"
我需要在数据库中的所有用户保存,有一种方法来显示用户的所有关注者?也许它由于IM在shell这样做呢?

Im using "api.user_followed_by" and it only shows 50 users, then shows a link with all the users, like "https://api.instagram.com/v1/users/<id>/followed-by?access_token=<ACCESS-TOKEN>" and i need to save in a DB all the users, there's a way to show all the followers of the user? maybe its because im doing this in the shell?

([User: victoriasecretmcb, User: laueleizalde, User: marellasdesign, User: caetano_nuno, User: eloy_fernandes, User: sparkles_design, User: xavinavas23, User: kikexr, User: ds_franklin, User: danielcaetano15, User: carlosalicova, User: donmiguelv, User: psteinvorth, User: hakvdub, User: _abrah, User: 7dimitri7, User: j.capote, User: roger_hannouch, User: gguerrero26, User: macmaquillaje02, User: ilgenuas, User: alem274, User: zebrols, User: edwinaleman69, User: gfmmartins, User: dego5, User: eliocastaneda3, User: jeancastilloc, User: dajosama, User: jamesdancer73, User: gavoonmaguire, User: nolygarcia62, User: maajiswim_siut, User: jjuankab, User: tikiticas, User: adefreitasvz, User: tenias66, User: obliviousowl_, User: lykus, User: mc_hasel, User: gabriela_m_oropeza_b, User: gabosanabria, User: adzamski, User: eishynena, User: tropical_chik_ve, User: teddy_bear567, User: cae_ucv, User: nikeexclusivo1, User: pablojmg, User: felixizarra], 'https://api.instagram.com/v1/users/307622607/followed-by?access_token=307622607.5593d6d.0936a78b99054931982b9b644ec75f48&cursor=1402704073642')

推荐答案

您需要使用分页。 API响应应该包括一个名为 next_url 价值,称那你会得到50个用户。有没有办法不分页,让他们的一次。

You need to use pagination. The API response should include a value called next_url, call that an you'll get 50 more users. There's no way to get them all at once without paginating.

请参阅 http://instagram.com/developer/endpoints/

在你的情况,你似乎是使用Python API库,所以加 as_generator = TRUE 当你调用 user_followed_by 。这应该返回一个发电机对象,您可以遍历。

In your case, you appear to be using the Python API Library, so add as_generator=True when you call user_followed_by. That should return a generator object that you can iterate over.

def example():
    generator = api.user-followed_by(as_generator=True, max_pages=None)
    for page in generator:
        print page #page will have the next 50 users, etc

这篇关于Instagram的API的Python用户后跟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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