lunoxis / instagram
这个库基于Instagram网页版。我们开发它是因为现在很难获得批准的Instagram应用程序。目的是支持网页桌面和移动版支持的所有功能
v1.0.1
2023-06-23 08:20 UTC
Requires
- guzzlehttp/guzzle: 7.4
This package is not auto-updated.
Last update: 2024-10-01 17:53:27 UTC
README
这是一个从Instagram提取媒体内容的简单库。
依赖关系
- PHP >= 8.0.6
登录示例
require __DIR__.'/vendor/autoload.php'; $ig = new Instagram\Login\Instagram('Username', 'Pass'); $cooki = $ig->login(); $session = new \Instagram\Login\Session(); print_r($session->SetSession($cooki->getCookieByName('rur')->getValue(),$cooki->getCookieByName('csrftoken')->getValue(),$cooki->getCookieByName('sessionid')->getValue(),$cooki->getCookieByName('ds_user_id')->getValue()));
通过链接获取帖子媒体
require __DIR__.'/vendor/autoload.php'; $media = new \Instagram\Media\Post('https://www.instagram.com/p/CfJec1mMLie/?igshid=YmMyMTA2M2Y='); print_r( $media->GetPost());
通过用户名获取账户信息
require __DIR__.'/vendor/autoload.php'; $info = new \Instagram\Media\Info('click.ir'); Get All Info print_r($info->GetInfo()); Get Info echo $info->GetInfo()[0]['username'];
通过故事链接获取故事
require __DIR__.'/vendor/autoload.php'; $story = new \Instagram\Media\Story('https://instagram.com/stories/pcgadjettv/2868234876450457114?igshid=MDJmNzVkMjY='); echo $story->GetLink();
通过用户名获取所有故事
require __DIR__.'/vendor/autoload.php'; $story = new \Instagram\Media\AllStory('click.ir'); print_r( $story->GetLink()); echo $story->MediaCount();
通过高亮链接获取高亮内容
require __DIR__.'/vendor/autoload.php'; $high = new \Instagram\Media\HighLight('https://www.instagram.com/s/aGlnaGxpZ2h0OjE3OTI5NjQ4NzIzOTAyNjMy?story_media_id=2768449635828641458_7247131961&igshid=YmMyMTA2M2Y='); echo $high->GetLink();
通过用户名获取所有高亮内容
require __DIR__.'/vendor/autoload.php'; $all = new \Instagram\Media\AllHighLight(); $all->GetAllHighLight('click.ir'); print_r($all->GetHighLight()); Download HighLight BY HighLight ID $all->GetHighLightmedia('highlight:17917690438338215'); print_r($all->HighLightLink());
安装
使用composer
composer.phar require lunoxis/instagram
或
composer require lunoxis/instagram
如果您没有composer
您可以从这里下载:这里。