我需要从Instagram帖子链接抓取图片和视频(例如:https://www.instagram.com/p/BZiTZWXABMp)。 当使用python的正常请求时,我没有在html响应中接收图像url。请帮帮我。
答案 0 :(得分:1)
您可以查看此网址:https://api.instagram.com/oembed/?url=<your-url>
返回一个json,你可以得到它的thumbnail_url
属性
在您要求的帖子中,要查询的网址是:https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BZiTZWXABMp/
在那里你可以获得图片网址:https://instagram.fmad3-4.fna.fbcdn.net/t51.2885-15/s480x480/e35/21984643_995308220608235_7854693412774084608_n.jpg
答案 1 :(得分:0)
非常简单,只需尝试在Instagram帖子链接的末尾添加/ media?size = l。
https://www.instagram.com/p/BZiTZWXABMp/media/?size=l
答案 2 :(得分:0)
使用脚本
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;
}