# kiryano/scout architecture

> Architecture diagram of the GitHub repository kiryano/scout, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kiryano/scout
- Repository: https://github.com/kiryano/scout

## Overview

#### Purpose and Entry Point
Scout is a Python 3.10+ interactive CLI for lead generation. It collects public profile data from social platforms, enriches records with contact information and email confidence, then exports leads to CSV. The executable orchestration point is `scout.py`; package code begins at `app/__init__.py`.

#### CLI Orchestration
`scout.py` owns command-line modes (`--verbose`, help, version), interactive user flow, bulk-input handling, scraper selection, enrichment invocation, and CSV export. It is the control-plane boundary between operator input and the scraping/enrichment pipeline.

#### Platform Scraper Layer
Platform-specific adapters normalize disparate profile pages and APIs into a consistent lead representation. Each scraper encapsulates authentication requirements, platform requests, extraction, and platform-specific fallback behavior.
- `app/scrapers/instagram.py`
- `app/scrapers/linkedin.py`
- `app/scrapers/github.py`
- `app/scrapers/youtube.py`
- `app/scrapers/tiktok.py`
- `app/scrapers/twitch.py`
- `app/scrapers/pinterest.py`

LinkedIn is the principal authenticated boundary: it consumes the `LINKEDIN_COOKIE` session value. GitHub may encounter unauthenticated API rate limits.

#### Link-in-Bio Discovery
`app/scrapers/linktree.py` expands a profile’s bio/link-in-bio URL into downstream social, website, messaging, and contact links. It supports Linktree plus related link-page providers, making it a fan-out stage between initial social discovery and website/contact enrichment.

#### Enrichment Pipeline
`app/scrapers/enrichment.py` transforms normalized scraped profiles into enriched leads. The sequence is: extract direct emails/phones from profile text; crawl the associated website and likely contact/about pages; infer company identity from profile text; resolve potential company domains through DNS/MX signals; derive email naming patterns; generate candidates; SMTP-verify candidates; assign source/verification-based confidence and lead score.

Optional Hunter.io support supplements the otherwise self-hosted DNS and SMTP approach.

#### Request Evasion and Network Boundary
`app/scrapers/stealth.py` and `app/scrapers/utils.py` provide shared HTTP behavior across scrapers, including user-agent rotation, request pacing, proxy selection, and extraction utilities. Network traffic crosses multiple unreliable or defended external services: social sites, profile APIs, arbitrary linked websites, DNS resolvers, and recipient SMTP servers.
- `app/scrapers/stealth.py`
- `app/scrapers/utils.py`

Proxy behavior is environment-driven: a single proxy, rotating proxy-file pool, or free proxy mode can be used; Twitch can fall back to direct connectivity when a proxy fails.

#### Data Boundaries and Outputs
The pipeline’s central data contract is the consistent profile/lead object passed from platform adapters to enrichment and then to CSV export under CLI control. Credentials and network settings remain externalized through environment variables, represented by `.env.example`; proxy pool input is represented by `proxies.example.txt`. No web-server or dashboard runtime exists in this repository; the operational runtime is the local Python CLI.

Main entry points: [`app/scrapers/enrichment.py`](https://github.com/kiryano/scout/blob/main/app/scrapers/enrichment.py) (Enrichment pipeline), [`scout.py`](https://github.com/kiryano/scout/blob/main/scout.py) (Scout CLI), [`app/scrapers/stealth.py`](https://github.com/kiryano/scout/blob/main/app/scrapers/stealth.py) (Stealth HTTP), [`app/scrapers/linkedin.py`](https://github.com/kiryano/scout/blob/main/app/scrapers/linkedin.py) (LinkedIn scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI Runtime"]
  node_scout["Scout CLI<br/>Python entry point<br/>[scout.py]"]
  node_package["Application package<br/>Python package<br/>[__init__.py]"]
  node_profile_contract["Normalized profile / lead<br/>data contract"]
  node_csv_export["CSV export<br/>output"]
end

subgraph group_scraping["Profile Acquisition"]
  node_platform_scrapers["Platform scrapers<br/>adapter layer"]
  node_instagram["Instagram scraper<br/>platform adapter<br/>[instagram.py]"]
  node_linkedin["LinkedIn scraper<br/>authenticated adapter<br/>[linkedin.py]"]
  node_other_platforms["Other platform adapters<br/>[github.py]"]
  node_linktree{{"Link-in-bio discovery<br/>fan-out adapter<br/>[linktree.py]"}}
  node_stealth["Stealth HTTP<br/>request policy<br/>[stealth.py]"]
  node_utils["Request &amp; extraction utilities<br/>shared utilities<br/>[utils.py]"]
end

subgraph group_enrichment["Lead Enrichment"]
  node_enrichment_engine["Enrichment pipeline<br/>lead transformer<br/>[enrichment.py]"]
  node_website_crawl["Website contact crawl<br/>discovery stage"]
  node_email_resolution["Domain &amp; email resolution<br/>verification stage"]
end

subgraph group_external["External Boundaries"]
  node_social_services{{"Social platforms &amp; APIs<br/>external services"}}
  node_web_dns_smtp{{"Websites, DNS &amp; SMTP<br/>network services"}}
  node_environment["Environment credentials<br/>operator configuration<br/>[.env.example]"]
  node_proxy_pool["Proxy pool input<br/>operator input"]
  node_hunter{{"Hunter.io<br/>optional enrichment API"}}
end

node_scout -->|"loads"| node_package
node_scout -->|"selects"| node_platform_scrapers
node_platform_scrapers -.->|"includes"| node_instagram
node_platform_scrapers -.->|"includes"| node_linkedin
node_platform_scrapers -.->|"includes"| node_other_platforms
node_platform_scrapers -->|"normalizes into"| node_profile_contract
node_platform_scrapers -->|"expands bio links"| node_linktree
node_platform_scrapers -->|"uses"| node_stealth
node_platform_scrapers -->|"uses"| node_utils
node_stealth -->|"reads settings"| node_environment
node_stealth -.->|"rotates from"| node_proxy_pool
node_stealth -->|"requests"| node_social_services
node_linkedin -->|"reads cookie"| node_environment
node_linktree -->|"discovers links on"| node_web_dns_smtp
node_scout -->|"invokes"| node_enrichment_engine
node_profile_contract -->|"enriches"| node_enrichment_engine
node_enrichment_engine -->|"crawls"| node_website_crawl
node_website_crawl -->|"fetches"| node_web_dns_smtp
node_enrichment_engine -->|"resolves"| node_email_resolution
node_email_resolution -->|"queries and verifies"| node_web_dns_smtp
node_enrichment_engine -.->|"optionally supplements"| node_hunter
node_enrichment_engine -->|"adds confidence and score"| node_profile_contract
node_scout -->|"writes leads"| node_csv_export

click node_scout "https://github.com/kiryano/scout/blob/main/scout.py"
click node_package "https://github.com/kiryano/scout/blob/main/app/__init__.py"
click node_instagram "https://github.com/kiryano/scout/blob/main/app/scrapers/instagram.py"
click node_linkedin "https://github.com/kiryano/scout/blob/main/app/scrapers/linkedin.py"
click node_other_platforms "https://github.com/kiryano/scout/blob/main/app/scrapers/github.py"
click node_linktree "https://github.com/kiryano/scout/blob/main/app/scrapers/linktree.py"
click node_stealth "https://github.com/kiryano/scout/blob/main/app/scrapers/stealth.py"
click node_utils "https://github.com/kiryano/scout/blob/main/app/scrapers/utils.py"
click node_enrichment_engine "https://github.com/kiryano/scout/blob/main/app/scrapers/enrichment.py"
click node_environment "https://github.com/kiryano/scout/blob/main/.env.example"
click node_proxy_pool "https://github.com/kiryano/scout/blob/main/proxies.example.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scout,node_package,node_profile_contract,node_csv_export toneBlue
class node_platform_scrapers,node_instagram,node_linkedin,node_other_platforms,node_linktree,node_stealth,node_utils toneAmber
class node_enrichment_engine,node_website_crawl,node_email_resolution toneMint
class node_social_services,node_web_dns_smtp,node_environment,node_proxy_pool,node_hunter toneRose
```

## Components

### CLI Runtime

Local operator-facing control plane.

- [Scout CLI](https://github.com/kiryano/scout/blob/main/scout.py): Python entry point · Interactive modes, bulk flow, scraper selection, enrichment, and CSV export. · `scout.py`
- [Application package](https://github.com/kiryano/scout/blob/main/app/__init__.py): Python package · `app/__init__.py`
- **Normalized profile / lead**: data contract · Shared record passed from adapters through enrichment to export.
- **CSV export**: output

### Profile Acquisition

Platform adapters and shared request behavior.

- **Platform scrapers**: adapter layer · Normalizes platform profiles and encapsulates platform-specific fallbacks.
- [Instagram scraper](https://github.com/kiryano/scout/blob/main/app/scrapers/instagram.py): platform adapter · `app/scrapers/instagram.py`
- [LinkedIn scraper](https://github.com/kiryano/scout/blob/main/app/scrapers/linkedin.py): authenticated adapter · Uses the LINKEDIN_COOKIE session value. · `app/scrapers/linkedin.py`
- [Other platform adapters](https://github.com/kiryano/scout/blob/main/app/scrapers/github.py): platform adapters · GitHub, YouTube, TikTok, Twitch, and Pinterest acquisition. · `app/scrapers/github.py`
- [Link-in-bio discovery](https://github.com/kiryano/scout/blob/main/app/scrapers/linktree.py): fan-out adapter · Expands Linktree and related link pages into websites and contact links. · `app/scrapers/linktree.py`
- [Stealth HTTP](https://github.com/kiryano/scout/blob/main/app/scrapers/stealth.py): request policy · User-agent rotation, pacing, and proxy selection. · `app/scrapers/stealth.py`
- [Request & extraction utilities](https://github.com/kiryano/scout/blob/main/app/scrapers/utils.py): shared utilities · `app/scrapers/utils.py`

### Lead Enrichment

Website, domain, and email resolution stages.

- [Enrichment pipeline](https://github.com/kiryano/scout/blob/main/app/scrapers/enrichment.py): lead transformer · Coordinates contact extraction, website crawling, domain resolution, and scoring. · `app/scrapers/enrichment.py`
- **Website contact crawl**: discovery stage · Crawls associated sites plus likely contact and about pages.
- **Domain & email resolution**: verification stage · Uses DNS/MX, naming patterns, candidate generation, and SMTP verification.

### External Boundaries

Unreliable third-party services and operator-provided inputs.

- **Social platforms & APIs**: external services · Profile pages and APIs, including rate-limited or defended endpoints.
- **Websites, DNS & SMTP**: network services · Linked websites, DNS resolvers, and recipient mail servers.
- [Environment credentials](https://github.com/kiryano/scout/blob/main/.env.example): operator configuration · Credentials and network settings, including proxy modes. · `.env.example`
- [Proxy pool input](https://github.com/kiryano/scout/blob/main/proxies.example.txt): operator input · Optional rotating proxy-file source. · `proxies.example.txt`
- **Hunter.io**: optional enrichment API

## Connections

- Scout CLI → Application package: loads
- Scout CLI → Platform scrapers: selects
- Platform scrapers → Instagram scraper: includes
- Platform scrapers → LinkedIn scraper: includes
- Platform scrapers → Other platform adapters: includes
- Platform scrapers → Normalized profile / lead: normalizes into
- Platform scrapers → Link-in-bio discovery: expands bio links
- Platform scrapers → Stealth HTTP: uses
- Platform scrapers → Request & extraction utilities: uses
- Stealth HTTP → Environment credentials: reads settings
- Stealth HTTP → Proxy pool input: rotates from
- Stealth HTTP → Social platforms & APIs: requests
- LinkedIn scraper → Environment credentials: reads cookie
- Link-in-bio discovery → Websites, DNS & SMTP: discovers links on
- Scout CLI → Enrichment pipeline: invokes
- Normalized profile / lead → Enrichment pipeline: enriches
- Enrichment pipeline → Website contact crawl: crawls
- Website contact crawl → Websites, DNS & SMTP: fetches
- Enrichment pipeline → Domain & email resolution: resolves
- Domain & email resolution → Websites, DNS & SMTP: queries and verifies
- Enrichment pipeline → Hunter.io: optionally supplements
- Enrichment pipeline → Normalized profile / lead: adds confidence and score
- Scout CLI → CSV export: writes leads
