使用 instafeed 仅显示最新的 instagram 图片

Show only the newest instagram picture with instafeed

所以我只需要显示一张 Instagram 图片,这是来自 Instagram 帐户的最新图片。此 HTML 代码显示帐户拥有的所有图片。

<!DOCTYPE html>
<html>
<head>
    <title>Instagram</title>
    <style type="text/css">
        a img{ 
            width: 25%;
        }
    </style>
</head>
<body>
    <h1 style="text-align: center"></h1>
        <div id="instafeed-container"></div>



    <script src="https://cdn.jsdelivr.net/gh/stevenschobert/instafeed.js@2.0.0rc1/src/instafeed.min.js"></script>
    <script type="text/javascript">
    var userFeed = new Instafeed({
        
        get: 'user',
        target: "instafeed-container",
        resolution: 'low_resolution',
        accessToken: 'YOURACCESSTOKEN'
    });
    userFeed.run();
    </script>
</body>
</html>

那么如何筛选图片只显示最新的图片呢? 我尝试使用“限制:'1”, 但它根本没有显示任何内容。

您可以根据文档限制记录数,例如

limit : 1

在 Instafeed 对象中。

see here in the documentation