Instagram爬虫,支持用户、媒体、标签和位置。通过住宅和4G代理进行代理。

1.0 2021-03-22 18:03 UTC

This package is auto-updated.

Last update: 2024-09-23 01:45:43 UTC


README

Latest Stable Version Total Downloads License

Instagram爬虫,支持用户、媒体、标签、评论和位置。通过住宅和4G代理进行代理。

获取公共用户数据、媒体或搜索特定标签或位置,无需注册应用程序。

由于这个库使用Instagram的网页版本来爬取内容,如果这些页面的返回源代码发生变化,它可能随时会中断。

Instagram Scraper API使用智能代理平衡以更好地获取数据和避免阻塞,成功率非常高。

需求

  • Rapid API账户
  • PHP 5.6.0或更高版本

安装

composer require angeljunior/instagram-scraper

用法

启动API

提供您的Rapid API密钥

$is = new angeljunior\InstagramScraper('RAPID-API-KEY');

获取公共用户数据

返回Instagram个人资料的所有公共数据。

// by Username
$result = $is->getProfileByUsername('nike');

// by URL
$result = $is->getProfileByURL('https://www.instagram.com/nike/');

获取媒体

返回所有公共媒体。

// by User Id
$result = $is->getMedias(13460080);

// by public Hashtag
$result = $is->getMediaByHashtag('travel');

// by public Place
$result = $is->getMediaByLocation(108424279189115);

获取媒体数据

返回特定公共媒体数据。

// by Media Shortcode
$result = $is->getMediaByCode('CMe3AQxnhmd');

// by Media URL
$result = $is->getMediaByUrl('https://www.instagram.com/p/CMnW2SBMKiu/');

获取搜索结果

返回用户、标签或位置的列表。

// by Hashtags
$result = $is->searchHashtags('travel');

// by Location
$result = $is->searchLocations('New york');

// by Userame
$result = $is->searchUsers('nik');