下载Instagram的图片

1.接口地址

 https://www.instagram.com/p/shortcode/?__a=1

 如何获取shortcode

比如说文章地址是https://www.instagram.com/p/BhxqnqtH9Ws/?taken-by=lanlan521425

那么其shortcode就是BhxqnqtH9Ws

所以上述url对应的json链接就是

 https://www.instagram.com/p/BhxqnqtH9Ws/?__a=1

2.获取json然后命名jsonstr

然后用下面的解析方式获取当前Instagram的内容图片,经分析存在三种格式具体的自己按需选择,640,750,和1080

content_json = jsonstr.get("graphql").get("shortcode_media").get("edge_sidecar_to_children").get("edges")
for item in content_json:
   info_node = item.get("node").get("display_resources")

   print(info_node[2].get("src"))

  

猜你喜欢

转载自www.cnblogs.com/c-x-a/p/9146095.html
今日推荐