juliusgeorge/instascrapper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

juliusgeorge/instascrapper

最新稳定版本:v1.0.1

Composer 安装命令:

composer require juliusgeorge/instascrapper

包简介

A PHP package for scraping Instagram data.

README 文档

README

Overview

This project is an Instagram scraper designed to extract publicly available data from Instagram profiles, posts, and other accessible endpoints. It is intended for educational and research purposes only.

Features

  • Extract post details (captions, likes, comments, etc.).

Requirements

  • PHP 8.2 or higher
  • Required libraries (install via requirements.txt):
    • illuminate\container
    • guzzlehttp
    • php-webdriver\webdriver

Installation

  1. With composer:
    composer require juliusgeorge/instascrapper

Usage

This package requires you to authenticate with instagram There are two ways of doing that

  1. Via cookie Login to instagram grab the required cookies (rur,mid,sessionid,ig_id,ds_user_id,csrftoken) create an array of cookiename/value pair i.e

    [
        'rur' => 'rur value',
        'csrftoken' => 'csrftoken value',
        'mid' => 'mid value',
        'ig_id' => 'ig_id value',
        'ds_user_id' => 'ds_user_id value',
        'sessionid' => 'sessionid value'
    ]

    after that call the generateAuthCookie static method of the InstaAuth\Auth class use InstaAuth\Auth;

    $cookieAuth = Auth::generateCookieAuth($the_array)

    Authenticate the scrapper using

    Scrapper::cookieAuth($cookieAuth);

    you can also generate a cookie auth token by providing your password and email|username

    $auth = new Auth();
    $cookieAuth = $auth->login('your email|username', 'your password');

    use the cookie auth like in above step to authenticate

  2. Scrapping comments: Before scrapping you need to authenticate, you can do that using the steps above Scrapping comments is pretty straight forward:

    use InstaAuth\Auth;
    use InstaScrapper\Scrapper;
    use InstaScrapper\CommentScrapper;
    
    //authenticate the scrapper, we will be using cookie authentication here
    $cookie = [
        'rur' => 'rur value',
        'csrftoken' => 'csrftoken value',
        'mid' => 'mid value',
        'ig_id' => 'ig_id value',
        'ds_user_id' => 'ds_user_id value',
        'sessionid' => 'sessionid value'
    ]
    Scrapper::cookieAuth(Auth::generateCookieAuth($cookie));
    $commentScrapper = new CommentScrapper();
    //pass in data to the comment scrapper using the with method
    $commentScrapper->with([
        'shortcode' => 'the instagram post shortcode',
        'max_comment' => 'maximum number of comment to scrape'
    ]);
    $comments = $commentScrapper->scrape();

Disclaimer

This project is for educational purposes only. Scraping data from Instagram may violate their terms of service. Use responsibly and ensure compliance with applicable laws and regulations.

License

This project is licensed under the MIT License.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固