javascript 如何从 Twitter 实体获取直接的 Instagram 链接?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12682039/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 16:51:18  来源:igfitidea点击:

How can I get an direct Instagram link from a twitter entity?

phpjavascriptinstagram

提问by earl3s

I have a twitter feed and I can find the instagram url in a tweet.

我有一个推特提要,我可以在推文中找到 Instagram 网址。

{
    indices: [
        90,
        110
    ],
    url: "http://t.co/kF9EXifn",
    expanded_url: "http://instagr.am/p/QC8hWKL_4K/",
    display_url: "instagr.am/p/QC8hWKL_4K/"
}

What I need is to take the expanded url from that object "http://instagr.am/p/QC8hWKL_4K/" and get the link to justthe image itself, not the image on the Instagram site. Anyone know how to do that? Can I even derive the that link from the url?

我需要的是采取从对象“http://instagr.am/p/QC8hWKL_4K/”的展开网址并获得链接到刚刚图像本身,而不是图像上的Instagram的网站。有谁知道怎么做?我什至可以从 url 中导出那个链接吗?

回答by John C

You can get just the image by appending /media/to the URL. Using your example: http://instagr.am/p/QC8hWKL_4K/media/.

您可以通过附加/media/到 URL来获取图像。使用您的示例:http: //instagr.am/p/QC8hWKL_4K/media/

You can even specify a size,

你甚至可以指定一个尺寸,

One of t (thumbnail), m (medium), l (large). Defaults to m.

t(缩略图)、m(中)、l(大)之一。默认为 m。

So for a thumbnail: http://instagr.am/p/QC8hWKL_4K/media/?size=t

所以对于缩略图:http: //instagr.am/p/QC8hWKL_4K/media/?size=t

Documentation here.

文档在这里