diff --git a/main.py b/main.py index 8ec29cc..89a36c1 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,4 @@ -""" -Instagram Profile Scraper +# Instagram Profile Scraper by SoClose Society — https://soclose.co Digital solutions & software development studio. @@ -22,14 +21,13 @@ DISCLAIMER: This tool is provided for educational purposes only. Scraping Instagram may violate their Terms of Service. Use responsibly and at your own risk. -""" import csv import logging import os import random import sys -import time +time from pathlib import Path from bs4 import BeautifulSoup @@ -61,7 +59,6 @@ SCROLL_AMOUNT = 600 # Pixels to scroll down per iteration SAVE_INTERVAL = 50 # Save to CSV every N iterations - # --------------------------------------------------------------------------- # Helper Functions # --------------------------------------------------------------------------- @@ -122,7 +119,6 @@ def login(driver: webdriver.Chrome, username: str, password: str) -> bool: logger.info("Login successful.") return True - EXCLUDED_PATHS = { "/explore/", "/accounts/", "/reels/", "/stories/", "/direct/", "/directory/", "/developer/", "/about/", "/legal/", "/privacy/", @@ -199,7 +195,6 @@ def scrape_profiles(driver: webdriver.Chrome, output_file: Path) -> list[str]: return sorted(all_links) - # --------------------------------------------------------------------------- # Main Entry Point # --------------------------------------------------------------------------- @@ -221,7 +216,7 @@ def main() -> None: logger.error("Could not log in. Exiting.") return - input("\nNavigate to the page you want to scrape, then press ENTER to start...") + input(\"Navigate to the page you want to scrape, then press ENTER to start...\") links = scrape_profiles(driver, output_file) save_to_csv(links, output_file) @@ -235,6 +230,5 @@ def main() -> None: driver.quit() logger.info("Browser closed.") - if __name__ == "__main__": main()