2017-04-06 86 views
0

因此,我为此构建了一个基本的Python函数,但它只返回空列表?我已经看到了其他在线答案,这个问题涉及到退出API的沙箱,但我不知道该怎么做?这不是一个应用程序或任何东西,它是一个小测试脚本。根据位置/时间戳获取Instagram照片

的脚本如下:

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,我为任何解决方案真的)。

非常感谢,所以我一直在为这个查询工作四个小时,一无所有。

回答

1

你不能在沙盒模式下获得结果,你必须使用API​​来构建一个平台或应用程序,遵循instagram usecase和guidlines,然后通过instgram进行审查才能上线。如果不使用现有的应用程序,那么你在找什么。

+0

谢谢,这看起来像案例...发生的任何应用程序,以实现这一目的吗? – user3684314

+0

https://www.picodash.com使用日期/时间范围进行位置搜索 – krisrak

+0

非常感谢! – user3684314