【问题标题】:Don't work pagination on new Instagram url-api for locations (?__a=1) (native_location_data)不要在新的 Instagram url-api 上为位置 (?__a=1) (native_location_data) 工作分页
【发布时间】:2021-07-12 22:52:22
【问题描述】:

Instagram 开始对https://www.instagram.com/explore/locations/.../?__a=1 的请求做出新的回应: {"graphql":{"native_location_data:{...

旧响应是:{"graphql":{"location":{...

分页https://www.instagram.com/explore/locations/.../?__a=1&max_id=..。不起作用:Instagram 响应以及第一个请求 (https://www.instagram.com/explore/locations/.../?__a=1)

附:标签的分页(带有新响应)正常工作

附言并非所有用户都对请求有新的响应

【问题讨论】:

    标签: instagram instagram-api


    【解决方案1】:

    “native_location_data”响应对象需要不同的函数来遍历。例如,如果要捕获所有图像,请使用以下示例:

                    sections = instagram_resp['native_location_data']['recent']['sections']
                    for sub_section in sections:
                        if sub_section['layout_type'] == 'media_grid':
                            for item in sub_section['layout_content']['medias']:
                                if item['media'].get('image_versions2'):
                                    largest_res = sorted(
                                        item['media']['image_versions2']['candidates'],
                                        key=lambda o: o['height'] * o['width']
                                    )[-1]['url']
    

    【讨论】:

      猜你喜欢
      • 2018-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-24
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      相关资源
      最近更新 更多