【问题标题】:Instagram API tagging using Python使用 Python 进行 Instagram API 标记
【发布时间】:2015-06-29 04:36:21
【问题描述】:

我正在尝试打印出所有包含“Starhub”的标题文本。它有效,但我只能打印出总共 19 个文本。

找到这个函数:api.tag_recent_media(count, max_tag_id, tag_name) - https://github.com/Instagram/python-instagram

所以我使用了那个功能,但它失败了。我输入 50 个计数意味着我希望输出 50 个文本,但它只打印出 19 个。

我的代码:

from instagram.client import InstagramAPI
from instagram.bind import InstagramAPIError

access_token = "289615375.008d237.5f2085b9c5c6400bab78709cee949914"
client_secret = "7f79614f8fe04a569c56f8672239cb8d"

api = InstagramAPI(access_token=access_token, client_secret=client_secret)
recent_media, next_ = api.tag_recent_media(count=50, tag_name="Starhub")

count = 0

for media in recent_media:
  try:
      print media.caption.text, "--->", media.user.username
      print ""
       count += 1

  except UnicodeEncodeError:
      pass

print count

这段代码只打印出 19。所以我尝试做的是这个。

我在我的代码中添加了这个:

while next_:
 more_media, next_ = api.tag_recent_media(with_next_url=next_)
 recent_media.extend(more_media)

有错误:找不到路径变量的参数值;标签名称。

知道如何打印出所有带有“Starhub”标签的文本吗?

【问题讨论】:

    标签: python api python-2.7 tags instagram


    【解决方案1】:

    我也无法使用 with_next_url。我最终将 'next_' 变量中的 max_tag_id 放回 tag_recent_media 的 'max_tag_id' 参数中,这似乎有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多