I need crawl image and video from instagram post link (example:https://www.instagram.com/p/BZiTZWXABMp). When use normal request of python, I didn't recevie image url in html response. Please help me get it.
I need crawl image and video from instagram post link (example:https://www.instagram.com/p/BZiTZWXABMp). When use normal request of python, I didn't recevie image url in html response. Please help me get it.
It's very simple Just try adding /media?size=l at the end of your Instagram post link.
https://www.instagram.com/p/BZiTZWXABMp/media/?size=l
You can check this url: https://api.instagram.com/oembed/?url=<your-url>
A json is returned and you can get its thumbnail_url property
In your requested post, the url to query is: https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BZiTZWXABMp/
There you can get the image url: https://instagram.fmad3-4.fna.fbcdn.net/t51.2885-15/s480x480/e35/21984643_995308220608235_7854693412774084608_n.jpg
use script
javascript:
var host = window.location.hostname;
var pathname = window.location.pathname;
var fullurl = host + pathname;
var https_host = "https://" + host + pathname;
var ps = fullurl.split("/")[1];
switch (host) {
case "www.instagram.com":
switch(ps) {
case "p":
var linkvid = document.getElementsByClassName("tWeCl")[0];
if(linkvid == undefined){
var length_photo = document.getElementsByClassName("FFVAD").length;
var linkins = length_photo - 1;
var link_photo = document.getElementsByClassName("FFVAD")[linkins].currentSrc;
window.open(link_photo, '_blank');
}else{
var linkvid = linkvid.currentSrc;
window.open(linkvid, '_blank');
}
case "stories":
var photo = document.getElementsByClassName('y-yJ5')[0].src;
if(photo == null){
var video = document.getElementsByClassName('y-yJ5')[2].currentSrc;
window.open(video, '_blank');
}
else{
window.open(photo , '_blank');
}
break;
default:
window.open("http://insd.ga", '_blank');
}
break;
}