sujay1599 / InstagramTheftyScraperPosterHuman

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.
MIT License
9 stars 2 forks source link

InstagramTheftyScraperPosterHumanV3.0 #8

Closed sujay1599 closed 1 month ago

sujay1599 commented 1 month ago

Better than ever!### Updated README for InstagramTheftyScraperPosterHuman V3.0

InstagramTheftyScraperPosterHumanV3.0

8/5/2024

High-Level Changes

CHANGE LOG:

V3.0: Enhanced Breakdown of Changes in InstagramTheftyScraperPosterHuman V3.0 vs 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:

  1. Logging Enhancements: Uses rich.console.Console for more detailed logging.
  2. Session Handling: Improved session management with save_session, load_session, and update_session_file functions.
  3. Time Zone Setting: Sets CST (Chicago) time zone during login.
  4. Enhanced Re-login: Adds relogin function for better session handling.
  5. Modular Code: More modular with separate functions for session handling.
  6. Session Injection: Utilizes inject_sessionid_to_public to ensure public session usage.

main.py:

  1. Configuration Validation: Ensures required keys in the scraping section.
  2. Session Management: Improved with perform_login, update_session_file, and relogin functions.
  3. Rate Limit Handling: Adds handle_rate_limit function with retries and exponential backoff.
  4. Delay Range: Sets a delay range for human-like behavior.
  5. Proxy Support: Adds support for proxies (not yet tested).
  6. Default Descriptions and Comments: Moves default descriptions and comments to separate files for easier management.
  7. Error Handling: More robust error handling with detailed logging.

utils.py:

  1. Enhanced Logging: Improved logging messages for better clarity.
  2. Session Management: Ensures better handling of session files.
  3. Functionality Additions: Minor updates to align with other enhanced functionalities.

scrape.py:

  1. Human-Like Actions: Randomly selects actions from a list of lambda functions.
  2. Media Handling: Simplifies the process by performing actions directly on media.
  3. Logging Enhancements: Improved logging messages.
  4. Scraping Logic: Uses profile_reel_id for uniqueness.
  5. Default Comments: Comments moved to a separate file for easier management.
  6. Error Handling: More detailed logging for exceptions.

upload.py:

  1. Default Descriptions: Descriptions moved to a separate file for easier management.
  2. Human-Like Actions: More seamlessly integrated with improved logging.
  3. Description Building: Enhanced with additional branding messages.
  4. Dashboard Display: Displays the dashboard after each upload.
  5. Resource Management: Improved logging for resource management.
  6. Loop Logic: Maintains the waiting period logic with random sleep intervals.

Features

Core Features

New Features in InstagramTheftyScraperPosterHuman V3.0

Requirements

Install Required Packages

You can install all the required packages using the following command:

pip install -r requirements.txt

Installation

  1. Clone the repository:

    git clone https://github.com/sujay1599/InstagramTheftyScraperPosterHuman.git
    cd InstagramTheftyScraperPosterHuman
  2. Install the required packages using requirements.txt:

    pip install -r requirements.txt
  3. Run config_setup.py to create the config.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, proxy settings, default descriptions, and comments.

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_descriptions:
    - "Custom description 1"
    - "Custom description 2"
    - "Custom description 3"
hashtags:
  use_hashtags: true
  hashtags_list: "example hashtags"
credit:
  give_credit: true
leave_comment: true
comments:
  - "Nice reel!"
  - "Great post!"
  - "Awesome!"
  - "Love it!"
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

Default Descriptions and Comments

The default descriptions and comments are used when the use_original option is set to false for descriptions and leave_comment is set to true. During the configuration setup, users can input their own default descriptions and comments. These defaults will be used during the uploading and commenting processes, providing more flexibility and personalization for the user.

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:

  1. Decryption of Credentials:

    • Decrypts stored Instagram credentials using a generated key.
  2. 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.

  1. Generating Key:

    • Uses cryptography.fernet.Fernet to generate an encryption key.
  2. Encrypting Credentials:

    • Encrypts the Instagram username and password using the generated key.
  3. Getting User Inputs:

    • Prompts the user for various configuration details such as profiles to scrape, number of reels, intervals, proxy settings, default descriptions, and default comments.
  4. Creating and Saving Configuration:

    • Creates a YAML configuration file with all the provided details and encrypted credentials.
  5. 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.

  1. 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.

  1. 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.

  1. Configuration and Initialization:

    • Reads the config.yaml file to get the configuration settings.
    • Initializes logging and status files using utility functions from utils.py.
  2. 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.
  3. 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.
  4. Uploading Logic:

    • Handles the uploading of scraped reels, including adding descriptions, hashtags, and crediting the original posters. This logic is found in upload.py.
  5. 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:

  1. 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.
  2. 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.

upload.py

Handles the uploading of scraped reels:

  1. Uploading Mechanism:

    • Uploads reels with customizable descriptions, hashtags, and credits.
    • Supports adding reels to Instagram stories if configured.
  2. Default Descriptions:

    • Uses predefined default descriptions if custom descriptions are not provided.
  3. 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:

  1. Logging and Status Management:

    • Functions for reading and updating status files, logging uploads, and handling random wait times.
  2. Random Sleeps:

    • Implements random wait periods between actions to reduce bot detection.
    • Logs the random wait times to random-waits.json.
  3. 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:

Logging

The script maintains several log files to track activities and debug issues:

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.