Javascript 从URL加载instagram图像作为背景图像

Javascript 从URL加载instagram图像作为背景图像,javascript,api,caching,background,instagram,Javascript,Api,Caching,Background,Instagram,通过在末尾添加/media/?size=l,我可以轻松地从Instagram的URL抓取Instagram图像,即: https://www.instagram.com/p/BP73IwIABjh/media/?size=l leads to https://scontent-lhr8-2.cdninstagram.com/v/t51.2885-15/e35/16228593_1671098819857382_4895739311250472960_n.jpg?tp=1&_nc_

通过在末尾添加/media/?size=l,我可以轻松地从Instagram的URL抓取Instagram图像,即:

https://www.instagram.com/p/BP73IwIABjh/media/?size=l 

leads to 

https://scontent-lhr8-2.cdninstagram.com/v/t51.2885-15/e35/16228593_1671098819857382_4895739311250472960_n.jpg?tp=1&_nc_ht=scontent-lhr8-2.cdninstagram.com&_nc_cat=102&_nc_ohc=CWyp6r9aeMkAX_yPiOL&edm=AGenrX8BAAAA&ccb=7-4&oh=5674d672622792f99bc091026f209fad&oe=60BFF349&_nc_sid=5eceaa
这是伟大的作品,但我想用这个图像作为我的网站上的背景。但是如果不访问URL,什么都不会被提取。i、 e

<li style="background: #ebeefc url(https://www.instagram.com/p/BP73IwIABjh/media/?size=l) center center no-repeat;background-size:cover;">
  • 这不起作用,只显示背景色#ebeefc

    是否可以从instagram URL加载背景图像,或者使用少量javascript预加载图像并拉取转发的URL?我会使用instagram API,但似乎不可能仅使用post URL以这种方式获取图像


    欢迎任何想法。

    您必须使用instagram的API

    如果你在网页上读到你的链接,它会说

    此终结点已弃用。请阅读以了解如何迁移端点

    或者你可以下载图像并自己存储。我还建议您,如果您只想为您的图像设置一个存储空间的话