alterebro/instagram-feed

无需使用OAuth、令牌或API即可访问最新的Instagram帖子

v0.1.4 2020-11-22 20:51 UTC

This package is auto-updated.

Last update: 2024-09-23 05:35:25 UTC


README

无需OAuth凭证或访问令牌,即可从Instagram用户或标签获取最新图片。这不是使用Instagram API平台或Graph API,因此无需您在任何地方进行身份验证、授权或注册应用程序。

安装

composer require alterebro/instagram-feed

如何使用它

require __DIR__ . '/vendor/autoload.php';

use Alterebro\InstagramFeed;

$feed = new InstagramFeed(
    $query,     // i.e: "@alterebro"
    $cachePath  // i.e: __DIR__ . "/tmp/"
);
$feed->JSON();

参数

必填

  • $query : 以'@'开头的字符串用于检索用户名,或无需'@'用于获取标签
  • $cachePath : 存储数据的文件夹。例如:/tmp/chmod 777 /tmp

可选

  • $feedItems : 要检索的项目。默认为6个项目。
  • $cacheTime : 缓存持续时长。默认为86400秒(1天)。
  • $cacheForce : 强制缓存数据。默认为false
// Retrive 10 items from user @alterebro and stores it on the /tmp/ folder for 12 hours / half day (43200 seconds)
$feed = new InstagramFeed('@alterebro', '/tmp/', 10, 43200);

// Get the data :
$data = $feed->load();

// or Output as JSON :
$feed->JSON();