Instagram API/tags/{tag-name}/media/recent更改的行为 [英] Instagram API /tags/{tag-name}/media/recent changed behaviour

查看:70
本文介绍了Instagram API/tags/{tag-name}/media/recent更改的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为此端点工作了好几次,似乎自从本​​周传递max_id值以来,抛出了一个错误,它说:

I worked several times with this endpoint and it seems that since this week when I pass a max_id value an error is thrown, it says:

{
    "meta":  {
        "error_type": "APIInvalidParametersError",
        "code": 400,
        "error_message": "max_id must not be a media id."
    }
}

我不知道在哪里可以找到api是否已更改行为或只是已损坏.
你们有什么想法吗?

I have no idea where to find if api has changed behaviour or simply it's broken.
Guys, do you have any idea?

我发现的另一个错误是查询此终结点时返回的媒体的顺序.这是一个示例数据:

Another error that I've found is the order of returned Medias when I query this endpoint. Here's a sample data:

#sample error
[
    Media: 1220853576116214570_1383882821
    Media: 1220853572180739674_233961632
    Media: 1220853571106323542_44255974
    Media: 1220853327487332588_16383867
    Media: 1220853529276039536_37204591
    Media: 1220853517236612185_1342227858
    Media: 1220853478513480317_596571
    Media: 1220853329006327307_299159508
    Media: 1220853296836482014_1829274963
    Media: 1220853282356978078_1498664215
    Media: 1220853191933038656_528166155
    Media: 1220481246711237359_211289081  #MEDIA INCORRECT ORDER
    Media: 1220853144521663282_3026017167
    Media: 1220853127735637950_619046756
    Media: 1220853103550902683_2074401387
    Media: 1220853106444172011_3020165605
    Media: 1220449359646948005_208916789  #MEDIA INCORRECT ORDER
    Media: 1220853071011680880_596571
    Media: 1220852985861033044_446238634
    Media: 1220852995848611111_3098675456
    Media: 1220852944343050919_1126655937
    Media: 1220852926209616200_327453609
    Media: 1220852902671104371_351483533
    Media: 1220852898165133786_207127275
    Media: 1220852887618705294_1736270372
    Media: 1220852850174855566_1133338201
    Media: 1220852831895483805_30557620
    Media: 1220851564341433250_1460935835
    Media: 1220852721064734213_14247170
    Media: 1220852681564341476_1329013696
    Media: 1220852647186623946_2143587522
    Media: 1220852634988856098_6331807
    Media: 1220852621030972511_530287550
]

编辑:我刚刚检查了python instagram的客户端是否已在9天前弃用,并且从3月23日开始有很多关于api行为的stackoverflow问题.很多巧合

Edit: I've just checked that python instagram's client has been deprecated 9 days ago, and there's a lot of stackoverflow questions about api behaviour's from 23-march. A lot of coincidences

  • Instagram /v1/tags/{tag-name}/media/recent端点在分页块中未返回min_tag_id
  • 错误400:通过Coldfusion从instagram API获取json数据时请求错误
  • API标签端点错误-min_id不是此标签的有效游标


  • 计数参数不能大于33,否则省略.换句话说,每页最大记录数为33

    由于另一个未记录的行为更改,Python客户端自6月1日起中断

  • Instagram /v1/tags/{tag-name}/media/recent endpoint doesn't return min_tag_id in pagination block
  • Error 400: Bad request while fetching json data from instagram api via coldfusion
  • API Tags endpoint error - min_id is not a valid cursor for this tag


  • Edit 2: count parameter can't be greater than 33, omitted otherwise. In another words, max records per page number is 33

    Edit 3: Python client's broken since 1st of June due another undocumented behaviour change

      File "/usr/local/lib/python2.7/dist-packages/instagram/bind.py", line 194, in _call
        return method.execute()
      File "/usr/local/lib/python2.7/dist-packages/instagram/bind.py", line 186, in execute
        content, next = self._do_api_request(url, method, body, headers)
      File "/usr/local/lib/python2.7/dist-packages/instagram/bind.py", line 148, in _do_api_request
        obj = self.root_class.object_from_dictionary(entry)
      File "/usr/local/lib/python2.7/dist-packages/instagram/models.py", line 88, in object_from_dictionary
        for comment in entry['comments']['data']:
    KeyError: 'data'
    


    编辑3已解决此处


    Edit 3 solved here

    推荐答案

    似乎您正在传递媒体ID作为分页.由于Instagram更改了分页值,因此您不能再这样做了.它曾经是一个媒体ID,但现在是一个字符串.

    It seems that you're passing a media id as pagination. You can't do that anymore since Instagram changed the pagination values. It used to be a media id, but now is a string.

    当您执行请求时,您将收到这样的json:

    When you do the request, you'll receive an json like this:

    {
        pagination: {
            next_max_tag_id: ...,
            deprecation_warning: "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead",
            next_max_id: ...,
            next_min_id: ...,
            min_tag_id: ...
            ...
        },
        meta: {
            ...
        },
        data: {
            ...
        }
    }
    

    只需在您的请求中将next_max_id值用作max_tag_id.那应该工作.

    Just use the next_max_id value as max_tag_id in your request. That should works.

    这篇关于Instagram API/tags/{tag-name}/media/recent更改的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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