Instagram URL --> JSON

Instagram URL --> JSON

如何使用 PHP 将 public instagram URL 转换为 JSON?例如:https://www.instagram.com/explore/tags/brindle/

我无法使用 API,因为我需要 public 主题标签内容,而且我的用例不符合他们的应用程序审核流程的条件:-(.

这是我目前所拥有的,但它并没有提取所有图像。此外,我还希望能够加载 "load more" 图像。任何帮助将不胜感激!

$instagram_source = file_get_contents("https://www.instagram.com/explore/tags/brindle/");
$instagram_data = explode("window._sharedData = ", $instagram_source);
$instagram_json = explode(';</script>', $instagram_data[1]);
$instagram_array = json_decode($instagram_json[0], TRUE);

$instagram_media = $instagram_array['entry_data']['TagPage'][0]['tag']['media']['nodes'];
if(!empty($instagram_media)) {
echo '<ul>';
foreach($instagram_media as $im) {
echo '<li>';
    echo '<a href="https://www.instagram.com/p/'.$im['code'].'/" target="_blank">';
        echo '<img src="'.$im["display_src"].'" alt="" width="'.$im["dimensions"]["width"].'" height="'.$im["dimensions"]["height"].'" />';
    echo '</a>';
echo '</li>';
}
echo '</ul>';
}

在此处查看此解决方案:https://github.com/Bolandish/Instagram-Grabber

这是迄今为止我所知道的最好的。