Skip to main content

Implement Instagram Posts Scraper for post data retrieval

Project description

Instagram Posts Scraper

InstagramPostsScraper is a Python library for collect instagram users' data.

The data obtained by web crawlers is not real-time data, but rather data from a specific point in time on the same day.

I’d really appreciate your support! You can star ⭐ or fork this repository to help me keep sharing more interesting web scrapers.

Support Me

If you enjoy this project and would like to support me, please consider donating 🙌
Your support will help me continue developing this project and working on other exciting ideas!

💖 Ways to Support:

Thank you for your support!! 🎉

Requirements

beautifulsoup4==4.13.4
cloudscraper==1.2.71
lxml==6.1.1
pandas==2.2.3
pytz==2024.2
requests==2.32.3
selenium==4.33.0
seleniumbase==4.39.2

Installation

To install the latest release from PyPI:

pip install instagram-posts-scraper

Usage - Sample

from instagram_posts_scraper.instagram_posts_scraper import InstaPeriodScraper
from IPython.display import display

ig_posts_scraper = InstaPeriodScraper()
target_info = {"username": "stephencurry30", "days_limit": 5}
res = ig_posts_scraper.get_posts(target_info=target_info)
display(res)

Optional parameters

  • username: target instagram user
  • days_limit: Number of days within which to scrape posts..

Version

You can check the installed version and module documentation:

import instagram_posts_scraper

print(instagram_posts_scraper.__version__)  # e.g. 0.0.8
print(instagram_posts_scraper.__doc__)      # module documentation

Sample Output

The scraper returns a dictionary containing the target's profile, account_status, the scraping timestamp (updated_at), and a data list of posts.

Below is an abbreviated example (long media URLs are truncated with ... for readability). For the complete, real output see examples/example_output.json.

{
  "profile": {
    "introduction": [
      "Believer. Husband. Father. Founder. Philanthropist. Olympic Gold Medalist. NYT Best Selling Author. Philippians 4:13."
    ],
    "counts_of_posts": "1542",
    "followers": "57197761",
    "followings": "1277"
  },
  "account_status": "public",
  "updated_at": "2026-06-10T19:37:53.477096+08:00",
  "data": [
    {
      "type": "igtv",
      "sum": "#sponsored I won’t spoil it. You kinda have to see it for yourself 👀",
      "sum_pure": "#sponsored I won’t spoil it. You kinda have to see it for yourself",
      "shortcode": "6747491750303413544165",
      "time": 1774973529,
      "ftime": "2 months ago",
      "count_like": 140546,
      "count_comment": 753,
      "count_like_pure": "140k",
      "count_comment_pure": "753",
      "thum": "https://scontent-iad3-1.cdninstagram.com/...",
      "pic": "https://scontent-iad3-1.cdninstagram.com/...",
      "pic_p": "https://sp1.picnob.com/...",
      "down_pic": "https://scontent.cdninstagram.com/...",
      "is_video": true,
      "video": "https://scontent-iad3-1.cdninstagram.com/...",
      "down_video": "https://scontent.cdninstagram.com/..."
    }
    // ... more posts
  ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instagram_posts_scraper-0.0.8.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

instagram_posts_scraper-0.0.8-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file instagram_posts_scraper-0.0.8.tar.gz.

File metadata

  • Download URL: instagram_posts_scraper-0.0.8.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for instagram_posts_scraper-0.0.8.tar.gz
Algorithm Hash digest
SHA256 2ea7dccf5787526eafa899c621b49e7ca606224175d22820e20e4d662a327ea7
MD5 93d64a44c5c08ddc5eabb8d506561bdf
BLAKE2b-256 32713bedccf7d25fbabe2202dcb1b8ff841d8e34ddd96d9df22aaa2be7cd7e58

See more details on using hashes here.

File details

Details for the file instagram_posts_scraper-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for instagram_posts_scraper-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f8f19fea33ee0911e120e316199fb8778e49c461611d0bf5aa2a4e7e817b9d88
MD5 a0e2a83bfba841404286107138136d74
BLAKE2b-256 7b4870a4886dafdcb03723cc458f3b160d2f4a9295c733f292f96fd284d34e5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page