- 4 ответа
- 0 вопросов
1
Вклад в тег
from requests import get
ig_api_key = 'YOUR INSTAGRAM API KEY'
answer = get('https://api.instagram.com/v1/users/search?q=facebook' + '&access_token=' + ig_api_key, verify=True).json()
print answer
def get_data_from_json(json_text):
answer = list()
for element in json_text['data']:
answer.append(element)
return answer
def get_media(username):
answer = list()
user_id = get_user_id(username)
data = get('https://api.instagram.com/v1/users/' + user_id + '/media/recent/?access_token=' +\
ig_api_key, verify=True).json()
try:
if data[u'meta'][u'code'] == 200:
if data[u'pagination'] == {}:
answer += get_data_from_json(data)
else:
answer += get_data_from_json(data)
while True:
if data[u'pagination'] != {}:
data = get(data[u'pagination'][u'next_url'], verify=True).json()
answer += get_data_from_json(data)
else:
break
else:
answer = list()
except:
answer = list()
return answer
q=ig_hashtag(HASHTAG)+%7B+media.after(J0HV59zAwAAAF0HV59y8AAAAFkYA%2C+11)+%7B%0A++count%2C%0A++nodes+%7B%0A++++caption%2C%0A++++code%2C%0A++++comments+%7B%0A++++++count%0A++++%7D%2C%0A++++date%2C%0A++++dimensions+%7B%0A++++++height%2C%0A++++++width%0A++++%7D%2C%0A++++display_src%2C%0A++++id%2C%0A++++is_video%2C%0A++++likes+%7B%0A++++++count%0A++++%7D%2C%0A++++owner+%7B%0A++++++id%0A++++%7D%2C%0A++++thumbnail_src%2C%0A++++video_views%0A++%7D%2C%0A++page_info%0A%7D%0A+%7D&ref=tags%3A%3Ashow
на хост https://www.instagram.com/query/, параметр стоящий в media.after, подозреваю, айдишник самого позднего фото в текущей выборке