A convenient way to harvest Reels data without breaking a sweat—or Instagram's TOS
Project description
Reel Scraper
Scrape Instagram Reels data with ease—be it a single account or many in parallel—using Python, threading, robust logging, and optional data-saving.
Installation • Usage • Classes • Contributing • License • Acknowledgments • Disclaimer
💻 Installation
Reel Scraper requires Python 3.9+. Install it from PyPI:
pip install reelscraper
Alternatively, clone from GitHub:
git clone https://github.com/andreaaazo/reelscraper.git
cd reelscraper
python -m pip install .
🚀 Usage
Reel Scraper now supports additional logging and data-saving functionalities. Below are two common ways to run the scraper—either interactively or via a CLI entry point (if provided).
1. Single Account or Single-Session Scraping
Use the ReelScraper class for scraping Reels from one Instagram account at a time. Optionally, integrate a LoggerManager to get detailed logs during retries and processing.
from reelscraper import ReelScraper
from reelscraper.utils import LoggerManager
# Optionally configure the logger
logger = LoggerManager()
# Initialize with a 30-second timeout, no proxy, and logging enabled
scraper = ReelScraper(timeout=30, proxy=None, logger_manager=logger)
# Fetch up to 10 reels for username "someaccount"
reels_data = scraper.get_user_reels("someaccount", max_posts=10)
for reel in reels_data:
print(reel)
2. Multiple Accounts with Concurrency & Data Saving
Use the ReelMultiScraper class to process multiple Instagram accounts concurrently. In addition to concurrency, you can now enable logging and automatically save the results using a DataSaver.
from reelscraper import ReelScraper, ReelMultiScraper
from reelscraper.utils import LoggerManager, DataSaver
# Configure logger and data saver
logger = LoggerManager()
data_saver = DataSaver("json")
# Initialize a single scraper instance with logging
single_scraper = ReelScraper(timeout=30, proxy=None, logger_manager=logger)
# Initialize the multi-scraper with the data saver and custom concurrency settings
multi_scraper = ReelMultiScraper(
scraper=single_scraper,
logger_manager=logger,
max_workers=5, # Number of threads
data_saver=data_saver
)
# Provide a file with one username per line:
# accounts.txt content example:
# user1
# user2
# user3
accounts_file_path = "accounts.txt"
# Start the multi-account scraping process:
# Optionally, define max_posts_per_profile and max_retries_per_profile.
all_reels = multi_scraper.scrape_accounts(
accounts_file=accounts_file_path,
max_posts_per_profile=20,
max_retires_per_profile=10
)
# Display overall (aggregated) results:
print(f"Total reels scraped: {len(all_reels)}")
Note: The multi-account scraper reads usernames from your provided file (one per line) and aggregates reels across all accounts. Logging messages and progress are displayed during processing if
LoggerManageris configured. The final result is saved ifDataSaveris configured.
🏗 Classes
ReelScraper
- Purpose:
Retrieves Instagram Reels data for a single account. - Key Components:
- InstagramAPI: Handles HTTP requests.
- Extractor: Formats raw data into structured reels information.
- LoggerManager (optional): Logs retries and status events.
- Key Method:
get_user_reels(username, max_posts, max_retries): Fetches reels for the specified user, applying pagination, retries, and logging.
ReelMultiScraper
- Purpose:
Scrapes multiple accounts concurrently using an underlyingReelScraperinstance. - Key Components:
- ThreadPoolExecutor: Manages concurrent requests.
- AccountManager: Loads accounts from a file.
- LoggerManager (optional): Tracks start, successes, errors, and final statistics.
- DataSaver (optional): Saves results to a file.
- Key Method:
scrape_accounts(accounts_file, max_posts_per_profile, max_retires_per_profile): Executes parallel scraping across the accounts listed in the provided file.
🤝 Contributing
We welcome contributions that make this scraper smarter, faster, or more resilient to changes. To contribute:
- Fork the project.
- Create a new branch.
- Commit your improvements (bonus points for clear comments and even a dash of humor).
- Submit a pull request.
Your contributions—whether bug fixes, new features, or documentation updates—are greatly appreciated!
📄 License
This project is licensed under the MIT License. Use, modify, or distribute the project freely (just be kind to your fellow developers and remember your caffeine intake).
🙏 Acknowledgments
- Python Community: For enabling an accessible approach to concurrency, API integration, and packaging.
- Instagram: For providing reels that inspire both creativity and the need for efficient scraping.
- Coffee & Tea: The timeless fuels behind countless hours of problem-solving and debugging.
⚠ Disclaimer
This project is for educational and personal use only. Always use it responsibly and in compliance with Instagram’s Terms of Service. We do not condone or endorse large-scale commercial scraping or any activity that violates policies. When in doubt, respect intellectual property and privacy the way you’d guard your grandmother’s cookie jar.
Happy scraping and may your CPU fans stay cool!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reelscraper-2.1.0.tar.gz.
File metadata
- Download URL: reelscraper-2.1.0.tar.gz
- Upload date:
- Size: 37.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c41e52e3ae0ab8b2cccf22b96910e6aa60c906832ae97d4d3c2fc15c7293330c
|
|
| MD5 |
1a8bb6ef68d8b07b872b5743d16e41e2
|
|
| BLAKE2b-256 |
8e7e0bef1458c0b2d3352257cd797948c766a896b45abc437b622a3ba3e3b5b4
|
Provenance
The following attestation bundles were made for reelscraper-2.1.0.tar.gz:
Publisher:
pypi-publish.yml on andreaaazo/reelscraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reelscraper-2.1.0.tar.gz -
Subject digest:
c41e52e3ae0ab8b2cccf22b96910e6aa60c906832ae97d4d3c2fc15c7293330c - Sigstore transparency entry: 162315339
- Sigstore integration time:
-
Permalink:
andreaaazo/reelscraper@5d5ef8b080aa89524c6debc4e0a2d825ecd257c5 -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/andreaaazo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@5d5ef8b080aa89524c6debc4e0a2d825ecd257c5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file reelscraper-2.1.0-py3-none-any.whl.
File metadata
- Download URL: reelscraper-2.1.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eaa08ae55316be6c47818036543abd6c17adc7e481dc7afc6def81d154ad734
|
|
| MD5 |
fa012010e5db66c004b27b51ffe2a202
|
|
| BLAKE2b-256 |
e62613c074554be026bd8bd78c80597cdcbdd458c293dd03825042914e864427
|
Provenance
The following attestation bundles were made for reelscraper-2.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on andreaaazo/reelscraper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reelscraper-2.1.0-py3-none-any.whl -
Subject digest:
8eaa08ae55316be6c47818036543abd6c17adc7e481dc7afc6def81d154ad734 - Sigstore transparency entry: 162315340
- Sigstore integration time:
-
Permalink:
andreaaazo/reelscraper@5d5ef8b080aa89524c6debc4e0a2d825ecd257c5 -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/andreaaazo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@5d5ef8b080aa89524c6debc4e0a2d825ecd257c5 -
Trigger Event:
push
-
Statement type: