how to get a image or video url from IG post?

Viewed 11585

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.

3 Answers

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

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;
        }
Related