按位置/时间戳获取Instagram照片



所以我为此目的构建了一个基本的 Python 函数,但它只返回空列表?我已经看到了这个问题的其他在线答案,其中涉及退出 API 的沙箱,但我不确定该怎么做?这不是一个应用程序或任何东西,它是一个小的测试脚本。

脚本如下:

def get_instagram_posts(name, time, coordinates):
    max_time_dt = time + timedelta(hours=3)
    min_time_dt = time - timedelta(hours=1)
    milli_max_time = int(calendar.timegm(max_time_dt.timetuple()))
    milli_min_time = int(calendar.timegm(min_time_dt.timetuple()))
    max_time = str(int(milli_max_time/1000))
    min_time = str(int(milli_min_time/1000))
    # Time has to be in seconds (no milliseconds).
    # See http://stackoverflow.com/questions/21091543/ajax-call-to-instagram-get-media-search-timestamp-issue
    dist_rad_str = str(insta_dist_radius_m)
    count_str = str(insta_count)
    api = InstagramAPI(access_token=insta_access_token, 
        client_secret=insta_client_secret)
    # https://www.instagram.com/developer/endpoints/media/
    r = api.media_search(name, count_str, str(coordinates[0]),
        str(coordinates[1]), min_time, max_time)
    print(r)

有什么办法可以做到这一点吗?(更改权限,更改查询,更改源API,我真的可以使用任何解决方案(。

非常感谢你,我已经在这个查询上工作了大约四个小时,什么都没有。

您无法在沙盒模式下获得结果,您必须使用 API 按照 Instagram 用例和指南构建平台或应用程序,然后由 Instgram 审核才能上线。 如果没有,请使用执行您正在寻找的现有应用程序。

最新更新