Instagram realtime get post from callback

前端 未结 3 2012
别跟我提以往
别跟我提以往 2021-02-14 11:19

Right, this is really working on my nerves, but Instagram has to do something about their bloody documentation.

I am already trying for a week to live update my website

3条回答
  •  礼貌的吻别
    2021-02-14 11:50

    Ok strike my old answer, I changed the way I do this. Here's how I'll do it now.

    I still wait for 10 hits on my Real-time subscription, when I reach 10 I send off a new thread (if one is not already running).

    The sync thread queries my DB for a value, I need the last min_tag_id I used. Then I query:

    https://api.instagram.com/v1/tags/*/media/recent?access_token=*&min_tag_id=*

    Try it out here: https://api.instagram.com/v1/tags/montreal/media/recent?access_token=*

    You'll get 20 results, and a min_tag_id value. Append that to your url, you'll see you get no results. Wait a couple of seconds and refresh. Eventually you'll get some media, and a new min_tag_id.

    (You can ignore the "next_url" value they give you, you won't be using that).

    Basically you only need to store that min_tag_id and query until you have no more results, that means you're done then.

提交回复
热议问题