Skip to content

Changes V2 to V2.1

sujay1599 edited this page Jul 23, 2024 · 1 revision

Key Differences and Enhancements of auth.py

  1. Logging Enhancements:

    • The new version uses rich.console.Console for logging instead of rich.logging.RichHandler. This provides more flexibility and detailed logging messages.
  2. Session Handling:

    • Old Version: Used client.load_settings and client.dump_settings to manage sessions.
    • New Version: Introduces save_session, load_session, and update_session_file functions for more robust session management, including handling cookies and authorization data.
  3. Time Zone Setting:

    • The new version sets the time zone offset to CST (Chicago) during login and re-login, which was not present in the old version.
  4. Enhanced Re-login Functionality:

    • The new version includes a relogin function to handle re-login scenarios, ensuring the session file is updated with the latest session information.
  5. Error Handling:

    • Both versions handle errors, but the new version provides more detailed error messages and prints them using console.print.
  6. Credential Encryption/Decryption:

    • Both versions use cryptography.fernet.Fernet for encrypting and decrypting credentials, but the new version has added generate_key and encrypt_credentials functions to handle encryption more explicitly.
  7. Code Structure:

    • The new version is more modular, with separate functions for session handling and re-login, making it more maintainable and extensible.

Key Differences and Enhancements for main.py

  1. Configuration Validation:

    • New Version: Adds validation to check for required keys in the scraping section to ensure all necessary configurations are present before running the script.
  2. Session Management:

    • Old Version: Calls login directly and handles session reuse within the login function.
    • New Version: Introduces perform_login, update_session_file, and relogin functions for better session management, including retries and exponential backoff.
  3. Rate Limit Handling:

    • New Version: Adds a handle_rate_limit function to manage rate limits and login required errors with exponential backoff and retries, enhancing the robustness of scraping and uploading operations.
  4. Delay Range:

    • New Version: Sets a delay range for the Instagram client to mimic human behavior, which was not explicitly set in the old version.
  5. Error Handling:

    • New Version: Provides more robust error handling with detailed logging and retries for scraping and uploading loops, including handling specific exceptions for rate limits and login requirements.
  6. Proxy Support:

    • New Version: Adds support for setting a proxy if specified in the configuration, enhancing flexibility for different network environments.
  7. Human-Like Actions:

    • Both versions perform human-like actions randomly during scraping, uploading, and waiting periods, but the new version ensures these actions are more seamlessly integrated with enhanced error handling and retries.

Key Differences and Enhancements for utils.py

  1. Code Structure and Functionality:

    • Both versions include functions for handling random sleeps, logging, and status file management, but the new version maintains the same overall structure and functionality with minor improvements in logging and error handling.
  2. Logging Enhancements:

    • Old Version: Uses rich.console.Console for logging.
    • New Version: Continues using rich.console.Console with consistent enhancements in log messages for better clarity.
  3. Session Management:

    • New Version: Ensures better handling of session files, including retries and error handling, although not explicitly different in utils.py, it's part of the overall enhancement in session management across the scripts.
  4. Error Handling:

    • Both versions handle errors, but the new version includes more detailed logging messages, ensuring that operations such as file deletions and status updates are logged with more clarity.
  5. Functionality Additions:

    • The functions remain largely the same, but the new version may include updates that align with other enhanced functionalities in the project, such as better handling of random wait times and upload times.
  6. Initialization and Updates:

    • Old Version: Initializes and updates JSON files and status files.
    • New Version: Maintains the same initialization and update functions with improved logging and message clarity.

Key Differences and Enhancements for scrape.py

  1. Human-Like Actions:

    • Old Version:
      • Uses three separate calls to hashtag_medias_recent_v1, hashtag_medias_top_v1, and hashtag_medias_top to gather media for human-like actions.
    • New Version:
      • Introduces a list of actions with lambda functions and randomly selects one to perform, simplifying and randomizing the selection process for human-like actions.
  2. Media Handling:

    • Old Version:
      • Combines media lists from different sources and ensures no duplicates before performing actions.
    • New Version:
      • Directly performs actions on the media returned by the randomly chosen function without combining lists, simplifying the process.
  3. Logging Enhancements:

    • New Version:
      • Improved logging messages to indicate the specific function used for finding media and providing more detailed messages throughout the scraping process.
  4. Scraping Logic:

    • Old Version:
      • Checks if the reel is already in uploaded_reels or scraped_reels using just the reel ID.
    • New Version:
      • Constructs a profile_reel_id combining profile and reel ID to ensure uniqueness and checks against uploaded_reels and scraped_reels using this composite ID.
  5. Error Handling:

    • Both versions handle errors, but the new version provides more detailed logging messages when exceptions occur during scraping or human-like actions.
  6. Status Updates:

    • Old Version:
      • Updates status with just the reel ID.
    • New Version:
      • Updates status with profile_reel_id to ensure the status includes unique identifiers for each scraped reel.
  7. Sleep Function:

    • Both versions use a random sleep function to mimic human behavior, but the new version includes additional detailed logging messages for better traceability.

Key Differences and Enhancements for upload.py

  1. Default Descriptions:

    • Old Version: Used general descriptions.
    • New Version: Added branding and promotional messages for social media accounts (@bigclappin, @bigclappinmemes, @big.clap.memes) to the default descriptions.
  2. Logging Enhancements:

    • Both versions utilize rich.console.Console for logging, but the new version may provide more detailed and consistent log messages throughout the upload process.
  3. Human-Like Actions:

    • Both versions perform human-like actions during wait times, but the new version ensures these actions are more seamlessly integrated with improved logging and detailed messaging.
  4. Error Handling:

    • Both versions handle errors, but the new version provides more detailed error messages and improved logging for exceptions during reel uploads and video resource releases.
  5. Description Building:

    • Old Version: Builds descriptions from a list of default descriptions, original descriptions, or custom descriptions based on configuration.
    • New Version: Enhances description building with additional branding messages.
  6. Dashboard Display:

    • Both versions call the dashboard display function after each upload and story upload to provide real-time updates.
  7. Wait Times:

    • Old Version: Sets a wait time of 60 to 180 seconds before uploading to the story.
    • New Version: Maintains similar wait times but includes additional random sleep intervals and detailed logging for better traceability.
  8. Resource Management:

    • Both versions release video resources after uploads, but the new version may include more detailed logging for resource management.
  9. Loop Logic:

    • Both versions include logic to handle the waiting period between uploads, with random sleep intervals and potential human-like actions during these periods.
  10. Minor Adjustments:

  • New Version: May include minor adjustments in logging, error handling, and sleep intervals to improve the overall robustness and maintainability of the script.

These key differences and enhancements make the new version of the InstagramTheftyScraperPosterHuman project more robust, user-friendly, and maintainable. The improvements in logging, session management, error handling, and integration of human-like actions ensure a smoother and more reliable automation process.