Free lead generation tool. Scrape Instagram, Twitch, TikTok, and LinkedIn profiles. Extract emails from bios, verify via SMTP, export to CSV.
add retry logic, proxy testing, and version flag
marcusb678dda0eed7
diff --git a/app/__init__.py b/app/__init__.pyindex f8df9f7..0748fef 100644--- a/app/__init__.py+++ b/app/__init__.py@@ -2,4 +2,4 @@Scout - Social media lead generation tool."""-__version__ = "1.0.0"+__version__ = "1.1.0"diff --git a/app/scrapers/linkedin.py b/app/scrapers/linkedin.pyindex c3d542d..ba7342e 100644--- a/app/scrapers/linkedin.py+++ b/app/scrapers/linkedin.py@@ -23,6 +23,27 @@ def _get_li_cookie() -> Optional[str]:return cookie+def validate_cookie() -> dict:+ """Check if LinkedIn cookie is valid."""+ cookie = _get_li_cookie()+ if not cookie:+ return {'valid': False, 'message': 'No cookie set'}++ try:+ client = httpx.Client(follow_redirects=True, timeout=15)+ client.cookies.set('li_at', cookie, domain='.linkedin.com')+ resp = client.get('https://www.linkedin.com/feed/')++ if resp.status_code == 200 and 'feed' in str(resp.url):+ return {'valid': True, 'message': 'Cookie is valid'}+ elif 'login' in str(resp.url) or 'authwall' in str(resp.url):+ return {'valid': False, 'message': 'Cookie expired - please re-export'}+ else:+ return {'valid': False, 'message': f'Unexpected response: {resp.status_code}'}+ except Exception as e:+ return {'valid': False, 'message': f'Connection error: {str(e)}'}++def _get_session():if _session_cache['client'] and _session_cache['csrf']:return _session_cache['client'], _session_cache['csrf']diff --git a/app/scrapers/stealth.py b/app/scrapers/stealth.pyindex 2c048df..0a38945 100644--- a/app/scrapers/stealth.py+++ b/app/scrapers/stealth.py@@ -2,7 +2,9 @@ import randomimport timeimport osimport logging-from typing import Optional+import requests+from typing import Optional, Callable+from functools import wrapslogger = logging.getLogger(__name__)@@ -108,3 +110,46 @@ def proxy_status() -> str:if os.environ.get('SCOUT_FREE_PROXY', '').lower() in ('1', 'true', 'yes'):return 'free'return 'none'+++def test_proxy() -> bool:+ """Test if current proxy is working."""+ proxy = get_requests_proxies()+ if not proxy:+ return True++ try:+ r = requests.get('https://httpbin.org/ip', proxies=proxy, timeout=10)+ return r.status_code == 200+ except Exception:+ return False+++def retry_request(max_retries: int = 3, delay: float = 2.0):+ """Decorator to retry failed requests."""+ def decorator(func: Callable):+ @wraps(func)+ def wrapper(*args, **kwargs):+ last_error = None+ for attempt in range(max_retries):+ try:+ return func(*args, **kwargs)+ except requests.exceptions.ProxyError as e:+ last_error = e+ logger.warning(f"Proxy error (attempt {attempt + 1}/{max_retries})")+ if attempt < max_retries - 1:+ time.sleep(delay)+ except requests.exceptions.Timeout as e:+ last_error = e+ logger.warning(f"Timeout (attempt {attempt + 1}/{max_retries})")+ if attempt < max_retries - 1:+ time.sleep(delay)+ except requests.exceptions.ConnectionError as e:+ last_error = e+ logger.warning(f"Connection error (attempt {attempt + 1}/{max_retries})")+ if attempt < max_retries - 1:+ time.sleep(delay)+ logger.error(f"All {max_retries} attempts failed: {last_error}")+ return None+ return wrapper+ return decoratordiff --git a/scout.py b/scout.pyindex 014ea78..1a17390 100644--- a/scout.py+++ b/scout.py@@ -13,6 +13,25 @@ if sys.platform == 'win32':sys.path.insert(0, str(Path(__file__).parent))+from app import __version__++if len(sys.argv) > 1:+ arg = sys.argv[1].lower()+ if arg in ('--version', '-v', 'version'):+ print(f"Scout v{__version__}")+ sys.exit(0)+ elif arg in ('--help', '-h', 'help'):+ print(f"Scout v{__version__} - Social media lead generation tool")+ print()+ print("Usage: python scout.py [options]")+ print()+ print("Options:")+ print(" --version, -v Show version")+ print(" --help, -h Show this help")+ print()+ print("Run without arguments to start the interactive menu.")+ sys.exit(0)+env_file = Path(__file__).parent / '.env'if env_file.exists():with open(env_file) as _f: