InstagramTheftyScraperPosterHumanV2.2
Updated README for InstagramTheftyScraperPosterHuman V2.2
7/28/2024
CHANGE LOG:
V2.2: Enhanced Breakdown of Changes in InstagramTheftyScraperPosterHuman V2.2 vs InstagramTheftyScraperPosterHuman V2.1
V2.1: https://github.com/sujay1599/InstagramTheftyScraperPosterHuman/wiki/Changes-V2-to-V2.1
V2: https://github.com/sujay1599/InstagramTheftyScraperPosterHuman/wiki/Enhanced-Breakdown-of-Changes-%E2%80%90-Appended#enhanced-breakdown-of-changes-in-instagramtheftyscraperposterhumanv2-vs-instagramtheftyscraperposterhumanv1
InstagramTheftyScraperPosterHuman V2.2
InstagramTheftyScraperPosterHuman is an advanced tool for automating the process of scraping, uploading, and managing Instagram reels. This tool builds upon previous versions, introducing several enhancements and new functionalities to improve automation, human-like interactions, and bot detection prevention.
Key Differences and Enhancements
auth.py:
- Logging Enhancements: Uses
rich.console.Console
for more detailed logging. - Session Handling: Improved session management with
save_session
,load_session
, andupdate_session_file
functions. - Time Zone Setting: Sets CST (Chicago) time zone during login.
- Enhanced Re-login: Adds
relogin
function for better session handling. - Modular Code: More modular with separate functions for session handling.
- Session Injection: Utilizes
inject_sessionid_to_public
to ensure public session usage.
main.py:
- Configuration Validation: Ensures required keys in the
scraping
section. - Session Management: Improved with
perform_login
,update_session_file
, andrelogin
functions. - Rate Limit Handling: Adds
handle_rate_limit
function with retries and exponential backoff. - Delay Range: Sets a delay range for human-like behavior.
- Proxy Support: Adds support for proxies.
- Error Handling: More robust error handling with detailed logging.
utils.py:
- Enhanced Logging: Improved logging messages for better clarity.
- Session Management: Ensures better handling of session files.
- Functionality Additions: Minor updates to align with other enhanced functionalities.
scrape.py:
- Human-Like Actions: Randomly selects actions from a list of lambda functions.
- Media Handling: Simplifies the process by performing actions directly on media.
- Logging Enhancements: Improved logging messages.
- Scraping Logic: Uses
profile_reel_id
for uniqueness. - Error Handling: More detailed logging for exceptions.
upload.py:
- Default Descriptions: Adds branding messages for social media accounts.
- Human-Like Actions: More seamlessly integrated with improved logging.
- Description Building: Enhanced with additional branding messages.
- Dashboard Display: Displays the dashboard after each upload.
- Resource Management: Improved logging for resource management.
- Loop Logic: Maintains the waiting period logic with random sleep intervals.
Features
Core Features
- Scraping Reels: Scrapes reels from specified Instagram profiles.
- Uploading Reels: Uploads scraped reels with customizable descriptions and hashtags.
- Human-like Actions: Performs random actions like liking, commenting, and following to mimic human behavior.
- Dashboard: Displays detailed information about activities.
- Anti-Bot Detection: Implements random waits and actions to avoid detection.
- Logging: Logs all activities for better traceability and debugging.
- Configurable Settings: Uses a YAML configuration file for easy customization.
New Features in InstagramTheftyScraperPosterHuman V3.0
- Enhanced Random Waits: Added random waits between scraping, liking, commenting, and uploading actions to better simulate human behavior and reduce the risk of detection by Instagram.
- Logging of Random Waits: Logged random wait times into a separate file (
random-waits.json
) for better tracking and debugging. - Detailed Logging of Comments: The program now logs the actual comments posted on each reel for better traceability.
- Improved Error Handling: Enhanced error handling and logging to capture JSONDecodeError and other exceptions, making the script more robust.
- Improved Dashboard: Updated dashboard to display detailed information about scraping, uploading, and random wait times, as well as the next file to be uploaded.
- Human-like Interactions: Performs random human-like actions during waiting periods, including liking and commenting on random posts from popular hashtags.
- Auto Restart Scraping: Automatically initiates the scraping process when there are no more videos left to upload in the downloads directory.
Requirements
- Python 3.6+
- Required Python packages (specified in
requirements.txt
)
Install Required Packages
You can install all the required packages using the following command:
pip install -r requirements.txt
Installation
-
Clone the repository:
git clone https://github.com/sujay1599/InstagramTheftyScraperPosterHuman.git cd InstagramTheftyScraperPosterHuman
-
Install the required packages using
requirements.txt
:pip install -r requirements.txt
-
Run
config_setup.py
to create theconfig.yaml
file:python config_setup.py
Follow the prompts to enter your configuration details. This will generate a
config.yaml
file with the necessary settings, including encrypted Instagram credentials and optional proxy settings.
Configuration
The config.yaml
file will be generated by running config_setup.py
. It includes the following settings:
instagram:
username: ENCRYPTED_USERNAME
password: ENCRYPTED_PASSWORD
key: ENCRYPTION_KEY
scraping:
enabled: true
profiles: profile1 profile2
num_reels: 10
scrape_interval_minutes: 60
like_reels: true
uploading:
enabled: true
upload_interval_minutes: 30
add_to_story: true
description:
use_original: true
custom_description: ""
hashtags:
use_hashtags: true
hashtags_list: "example hashtags"
credit:
give_credit: true
leave_comment: true
comments:
- "Nice reel!"
- "Great post!"
deleting:
delete_interval_minutes: 1440
custom_tags:
- instagram
- instadaily
- LikeForFollow
- LikesForLikes
- LikeForLikes
- FollowForFollow
- LikeForLike
- FollowForFollowBack
- FollowBack
- FollowMe
- instalike
- comment
- follow
- memes
- funnymemes
- memestagram
- dankmemes
- memelord
- instamemes
- instagood
- love
- photooftheday
- picoftheday
- likeforlikes
- likes
- followme
- photography
- beautiful
- fashion
- smile
- me
- followforfollowback
- l
- likeforfollow
- myself
- likeforlike
- bhfyp
- f
- followback
- followers
- followforfollow
- style
- photo
- happy
- instamood
- nature
- trending
- art
- india
- viral
- explore
- model
- travel
proxy: http://proxyserver:port # Add your proxy address here if you use one
Configuration Details
- Instagram Credentials: Provide your Instagram username and password. These will be encrypted and stored securely.
- Scraping Settings:
enabled
: Set totrue
to enable scraping.profiles
: Space-separated list of Instagram profiles to scrape reels from.num_reels
: Number of reels to scrape per profile.scrape_interval_minutes
: Interval in minutes between scraping sessions.
- Uploading Settings:
enabled
: Set totrue
to enable uploading.upload_interval_minutes
: Interval in minutes between uploads.add_to_story
: Set totrue
to add reels to your Instagram story.
- Description Settings:
use_original
: Set totrue
to use the original reel description. Iffalse
, you will be prompted to enter a custom description.custom_description
: The custom description to use ifuse_original
isfalse
.
- Hashtags Settings:
use_hashtags
: Set totrue
to use hashtags in the reel descriptions.hashtags_list
: List of hashtags to include in the reel descriptions (ifuse_hashtags
istrue
).
- Credit Settings:
give_credit
: Set totrue
to give credit to the original poster in the reel descriptions.
- Deleting Settings:
delete_interval_minutes
: Interval in minutes between deletions.
- Comments:
leave_comment
: Set totrue
to leave comments on scraped videos.comments
: List of comments to leave ifleave_comment
istrue
.
- Custom Tags: List of custom tags for human-like actions.
- Proxy: Optional proxy settings.
Usage
Run the script:
python main.py
This will start the process of scraping, uploading, and performing human-like actions as configured in the config.yaml
file.
Detailed Breakdown of
Files
auth.py
Handles Instagram authentication and session management:
-
Decryption of Credentials:
- Decrypts stored Instagram credentials using a generated key.
-
Login Management:
- Manages login sessions, checking for an active session first and creating a new one if necessary.
- Uses
instagrapi
to handle the authentication process. - Injects session IDs to the public session to maintain consistency.
config_setup.py
Generates the config.yaml
configuration file with encrypted credentials. Also deletes any old status and log files to ensure a clean start.
-
Generating Key:
- Uses
cryptography.fernet.Fernet
to generate an encryption key.
- Uses
-
Encrypting Credentials:
- Encrypts the Instagram username and password using the generated key.
-
Getting User Inputs:
- Prompts the user for various configuration details such as profiles to scrape, number of reels, and intervals.
- Includes prompts for proxy settings.
-
Creating and Saving Configuration:
- Creates a YAML configuration file with all the provided details and encrypted credentials.
-
Deleting Old Files:
- Deletes old status and log files to ensure a clean setup.
dashboard.py
Displays a detailed dashboard of activities, showing the status of scraping, uploading, and human-like actions.
- Dashboard Information:
- Displays the status of the last and next scrape, upload, and delete times.
- Shows random wait times and other detailed logs.
input_helpers.py
Contains helper functions for getting user inputs during configuration setup.
- Input Functions:
- Functions to get and validate different types of user inputs, such as integers, booleans, and strings.
main.py
The main script that orchestrates the scraping, uploading, and human-like actions processes. It reads the configuration, manages the workflow, and ensures periodic actions are performed.
-
Configuration and Initialization:
- Reads the
config.yaml
file to get the configuration settings. - Initializes logging and status files using utility functions from
utils.py
.
- Reads the
-
Authentication:
- Uses
auth.py
to handle Instagram login. It checks for an existing session and uses it if available, otherwise, it performs a manual login and creates a new session, while keeping the UUIDs the same to reduce bot detection.
- Uses
-
Scraping Logic:
- Calls
scrape.py
to handle the scraping of Instagram reels. - Performs human-like actions using the
perform_human_actions
function, including liking and commenting on posts to reduce bot detection.
- Calls
-
Uploading Logic:
- Handles the uploading of scraped reels, including adding descriptions, hashtags, and crediting the original posters. This logic is found in
upload.py
.
- Handles the uploading of scraped reels, including adding descriptions, hashtags, and crediting the original posters. This logic is found in
-
Logging and Random Waits:
- Implements random waits between actions to mimic human behavior and avoid detection.
- Logs all activities for traceability and debugging purposes.
scrape.py
Handles scraping of Instagram reels and performing human-like actions:
-
Scraping Functionality:
- Scrapes reels from specified Instagram profiles.
- Implements human-like interactions such as liking and commenting on random posts from popular hashtags to mimic human behavior.
-
Human-like Actions:
- The
perform_human_actions
function simulates human interactions by performing random actions during waiting periods, including liking and commenting on random posts.
- The
upload.py
Handles the uploading of scraped reels:
-
Uploading Mechanism:
- Uploads reels with customizable descriptions, hashtags, and credits.
- Supports adding reels to Instagram stories if configured.
-
Default Descriptions:
- Uses predefined default descriptions if custom descriptions are not provided.
-
Logging Uploads:
- Logs the upload activities and tracks the uploaded reels.
utils.py
Contains utility functions for logging, status management, random sleeps, and managing JSON files for random wait times:
-
Logging and Status Management:
- Functions for reading and updating status files, logging uploads, and handling random wait times.
-
Random Sleeps:
- Implements random wait periods between actions to reduce bot detection.
- Logs the random wait times to
random-waits.json
.
-
File Management:
- Functions to delete old status and log files to ensure a clean setup.
Anti-Bot Detection
The program includes several features to avoid detection by Instagram:
- Random Waits: Implements random waits between actions to mimic human behavior.
- Human-like Actions: Performs random actions like liking, commenting, and following during the waiting periods.
- Detailed Logging: Logs all activities for better traceability and debugging.
Logging
The script maintains several log files to track activities and debug issues:
- upload_log.txt: Keeps track of uploaded reels.
- status.json: Tracks the last action times and other status information.
- random-upload-times.json: Logs the random sleep times between uploads.
- random-waits.json: Logs the random wait times between various actions.
Dashboard
Run the dashboard script to view detailed information about scraping, uploading activities, and random wait times:
python dashboard.py
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
Disclaimer
This script is intended for educational and personal use only. Use it responsibly and ensure you comply with Instagram’s terms of service and guidelines.