无法获取完整的instagram个人资料图片

编程入门 行业动态 更新时间:2024-10-19 15:43:49
本文介绍了无法获取完整的instagram个人资料图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

几天前,我能够通过从图片网址中删除vp/并将分辨率从 s150x150 更改为 s720x720 来获取我的android应用中的inta个人资料图片exp,它工作正常,但现在我仍然收到"无效的URL签名",所以我认为instagram已在其URL中添加了签名,我通常在图片URL中从vp/到/t51删除parte....像这样

a few days ago i was able to fetch inta profile pic in my android app by remove vp/ from the pic URL and change the resolution from s150x150 to s720x720 for exp ,and it worked fine but now i still get "invalid url signature" , so i think instagram has added signature to their url ,I usually remove the parte from vp/ to /t51 in the pic URL... like this

scontent-mxp1-1.cdninstagram/ vp/xxxxxxxx /t51 .... jpg 但它不起作用!

scontent-mxp1-1.cdninstagram/vp/xxxxxxxx/t51....jpg but it doesn't work !!

我不知道instagram发生了什么,所以有人可以帮助我找到解决此问题的方法吗?或另一种方法.谢谢

I don't know what's happened with instagram,so can someone help meto find a solution for this problem? Or an alternate method . Thanks

推荐答案

以下是截至2020年5月如何在没有 www.instadp/.程序也可以使用此API方法.

Here's how to do it as of May 2020 without an external website like www.instadp/. Programs can also use this API method.

  • 首先,请确保您已登录浏览器上要执行此操作的Instagram帐户.

  • First, make sure you are logged into an Instagram account on the browser that you want to do this.

输入用户名代替此处的用户名";在此URL中:

Enter a username in place of "usernamehere" in this URL:

www.instagram/username此处/?__ a = 1

www.instagram/usernamehere/?__a=1

  • 访问URL.

    • Visit the URL.

      将数字复制到"profilePage_"之后;在开始时.这是用户ID.(它也位于 JSON .)

      Copy the number after "profilePage_" at the start. This is the userID. (It is also located under graphql.user.id in the JSON.)

      在此URL中粘贴数字,以代替此处的数字"

      Paste the number in this URL in place of "numberhere"

      i.instagram/api/v1/users/numberhere/info/

      i.instagram/api/v1/users/numberhere/info/

      • 访问URL.您很可能会看到 {"message":"useragent mismatch","status":"fail"} .如果您这样做,请执行以下步骤:

        • Visit the URL. You will most likely see {"message": "useragent mismatch", "status": "fail"}. If you do, perform the following steps:

          如果您使用的是Chrome,请按F12或Ctrl + Shift + I或Ctrl + Shift + J打开DevTools.

          If you are in Chrome, press F12 or Ctrl+Shift+I or Ctrl+Shift+J to open DevTools.

          在底图中(在其中看到控制台",新增功能",网络条件"),单击网络条件".

          In the bottom draw (where you see "Console", "What's New", Network conditions"), click "Network conditions".

          在用户代理"下,取消选中自动选择".

          Under "User agent", uncheck "Select automatically".

          选择自定义...",然后将Instagram移动用户代理粘贴到框中,如下所示:

          Select "Custom...", and paste an Instagram mobile user agent into the box, like this one:

          Mozilla/5.0(Linux; Android 9; GM1903 Build/PKQ1.190110.001; wv)AppleWebKit/537.36(KHTML,like Gecko)Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36 Instagram 103.1.0.15.119 Android(28/9; 420dpi; 1080x2260; OnePlus; GM1903; OnePlus7; qcom; sv_SE; 164094539)

          Mozilla/5.0 (Linux; Android 9; GM1903 Build/PKQ1.190110.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36 Instagram 103.1.0.15.119 Android (28/9; 420dpi; 1080x2260; OnePlus; GM1903; OnePlus7; qcom; sv_SE; 164094539)

          您可以在此处找到更多的信息.

          You can find more here.

          • 请勿关闭DevTools.刷新页面.

          • Do not close DevTools. Refresh the page.

          注意:有浏览器扩展可以做到这一点.

          Note: there are browser extensions that can do this.

          检查本教程,了解如何在其他浏览器上执行此操作.

          Check this tutorial for how to do this on other browsers.

          按Ctrl + F,然后搜索"hd_profile_pic_url_info".

          Press Ctrl+F, and search for "hd_profile_pic_url_info".

          在"url"和"url"之间复制URL.和宽度".这是很长的,所以请仔细看.(它位于JSON中的 user.hd_profile_pic_url_info.url 下.)

          Copy the URL between "url" and "width". It's a long one, so look carefully. (It is located under user.hd_profile_pic_url_info.url in the JSON.)

          注意:此这样的扩展名将使这一部分变得更加容易

          Note: extensions like this one will make this part so much easier.

          • 将URL粘贴到地址栏中,但不要按Enter.

          • Paste the URL in the address bar, but don't press Enter.

          查找"\ u0026"的所有实例.在网址中.URL的后半部分应大约有3个.这些是用于&"的JavaScript代码,但它们在地址栏URL中不起作用(如果按Enter键,您将看到 Bad URL timestamp ).将它们全部替换为&".

          Look for all instances of "\u0026" in the URL. There should be about 3 of them, in the second half of the URL. These are the JavaScript codes for "&", but they won't work in an address bar URL (you will see Bad URL timestamp if you press Enter). Replace them all with "&".

          访问URL.

          现在,您拥有了全分辨率的个人资料图片.:)

          Now you have your full-resolution profile picture. :)

          更新:最后,我们开始编写一个函数来获取此URL.您可以在浏览器中使用它,而不必执行所有这些步骤.

          UPDATE: Finally got round to writing a function to get this URL. You can use this in your browser, instead of having to go through all those steps.

          async function fetchIGProfilePic(input) { if (!/^https?:\/\/i.instagram\//.test(window.location.href)) { if (window.confirm('fetchIGProfilePic:\n\nWe need to navigate to i.instagram for the request to work. (We need to make the request from the same domain as the profile pic API; CORS policy.) Please run the script after doing this.\n\nNavigate to i.instagram? (Ignore the 404 error.)')) { window.location.href = 'i.instagram/api/v1/'; return; } else { return 'fetchIGProfilePic: Cancelled.'; } } let response; let output; try { response = await fetch('www.instagram/' + input + '/?__a=1'); if (!response.ok) { console.log('Failed 1st step, to fetch userID, with bad response status:' + response.status); return; } } catch(error) { console.log('Failed 1st step, to fetch userID, with ok response status: ' + error); return; } let userData = await response.json(); try { response = await fetch('i.instagram/api/v1/users/' + userData.graphql.user.id + '/info/', { // The following doesn't seem to be necessary in a console request, but I kept it in in case you have issues at this stage. headers: {'user-agent': 'Mozilla/5.0 (Linux; Android 9; GM1903 Build/PKQ1.190110.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.143 Mobile Safari/537.36 Instagram 103.1.0.15.119 Android (28/9; 420dpi; 1080x2260; OnePlus; GM1903; OnePlus7; qcom; sv_SE; 164094539)' } }); if (!response.ok) { console.log('Failed 2nd step, to fetch profile pic URL, with bad response status: ' + response.status); window.alert('fetchIGProfilePic:\n\nYou might not be logged in, which is necesary for the request to work. Please log into an Instagram account, then run this script again.'); return; } } catch(error) { console.log('Failed 2nd step, to fetch profile pic URL, with ok response status: ' + error); return; } let profileData = await response.json(); console.log('Full-size profile pic URL of ' + input + ':\n' + profileData.user.hd_profile_pic_url_info.url); } fetchIGProfilePic('instagram'); // Enter the username here.

          在浏览器中,按F12打开控制台,然后粘贴脚本.将用户名放在方括号中,然后按Enter,它将在控制台中检索URL.确保您使用的是 i.instagram/api/v1/并在运行脚本时登录到Instagram帐户.

          In your browser, press F12 to open the console, then paste the script in. You put the username in the bottom brackets, then press Enter, and it retrieves the URL in the console. Make sure you are on i.instagram/api/v1/ and logged into an Instagram account when you run the script.

更多推荐

无法获取完整的instagram个人资料图片

本文发布于:2023-10-11 23:06:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1483092.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:完整   个人资料   图片   instagram

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!