java无法获取instagram个人资料图片的完整大小
几天前,我能够在我的安卓应用程序中获取inta配置文件pic,方法是从pic URL中删除vp/并将exp的分辨率从s150x150更改为s720x720,效果很好,但现在我仍然得到“无效URL签名”,因此我认为instagram已经在他们的URL中添加了签名,我通常在picurl中从vp/to/t51中删除parte。。。像这样
https://scontent-mxp1-1.cdninstagram.com/vp/xxxxxxxx/t51。。。。jpg
但是它不起作用
我不知道instagram发生了什么,有人能帮我找到解决这个问题的方法吗?或者另一种方法。谢谢
# 1 楼答案
以下是如何在2020年5月没有像https://www.instadp.com/这样的外部网站的情况下完成这项工作。程序也可以使用此API方法
首先,确保您已登录到要执行此操作的浏览器上的Instagram帐户
在此URL中输入用户名以代替“usernamehere”:
访问URL
复制开始处“profilePage_u2;”后面的数字。这是用户ID。(它也位于JSON的
graphql.user.id
下。)将此URL中的数字粘贴到“numberher”的位置
访问URL。您很可能会看到
{"message": "useragent mismatch", "status": "fail"}
。如果是,请执行以下步骤:如果您使用的是Chrome,请按F12或Ctrl+Shift+I或Ctrl+Shift+J打开DevTools
在底部的绘图中(您会看到“控制台”、“新功能”、网络条件),单击“网络条件”
在“用户代理”下,取消选中“自动选择”
选择“自定义…”,然后将Instagram移动用户代理粘贴到该框中,如下所示:
你可以找到更多的here
不要关闭DevTools。刷新页面
注意:有browser extensions可以做到这一点
查看this tutorial了解如何在其他浏览器上执行此操作
按Ctrl+F,然后搜索“hd\U配置文件\U图片\U url\U信息”
在“URL”和“宽度”之间复制URL。它很长,所以仔细看。(它位于JSON中的
user.hd_profile_pic_url_info.url
下。)注意:像this one这样的扩展将使这部分变得更加容易
将URL粘贴到地址栏中,但不要按Enter键
在URL中查找“\u0026”的所有实例。在URL的后半部分应该有大约3个。这些是“&;”的JavaScript代码,但它们在地址栏URL中不起作用(如果按Enter键,您将看到
Bad URL timestamp
)。将它们全部替换为“&;”访问URL
现在您有了完整的分辨率配置文件图片。:)
更新:终于有时间写一个函数来获取这个URL。您可以在浏览器中使用它,而不必经历所有这些步骤
在浏览器中,按F12打开控制台,然后粘贴脚本。您将用户名放在下括号中,然后按Enter键,它将在控制台中检索URL。运行脚本时,请确保您在https://i.instagram.com/api/v1/上并登录到Instagram帐户