# xtekky/tiktok-viewbot architecture

> Architecture diagram of the GitHub repository xtekky/tiktok-viewbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xtekky/tiktok-viewbot
- Repository: https://github.com/xtekky/tiktok-viewbot

## Overview

##### Project type and purpose
- From the file tree and README, this is a CLI-based Python “viewbot” tool that automates sending view counts to TikTok via reverse-engineered API calls. It includes multiple script versions (v1, v2, etc.), a minimal JS helper (`zefoy/index.js`), and helper files for proxies and device fingerprinting.

##### File structure
- Top-level files:
- `viewbot.py` (main entry point)
- `v2.py` (enhanced version with captcha solver)
- `test.py`, `v2/test.py` (test harnesses)
- `config.json` (global settings)
- `requirements.txt` (dependencies)
- Subfolders:
- `old/` (legacy versions, Python & Go experiments, mobile scripts)
- `v2/` (packaged v2 scripts & test data)
- `zefoy/` (JavaScript stub for web interactions)
- Key patterns: versioned iterations, separation of core logic (`viewbot.py`/`v2.py`), config+data files (devices.txt, proxies.txt), and a small web helper.

##### README for additional insights
- Dependencies: `tls_client`, `requests`, `colorama`, `pillow`
- Usage flow: install deps → run script → the tool spins up HTTP calls to TikTok API, simulating different devices, rotating proxies, and solving captchas.
- No built-in database; ephemeral in-memory state, config files on disk.

##### Detail
- Break the Core Engine into its four sub-components rather than lumping everything together.
- Fallback flow from HTTP client to Captcha Solver and back.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Interface
    subgraph "CLI Interface"
        CLI_main["viewbot.py"]:::python
        CLI_v2["v2.py"]:::python
    end
    click CLI_main "https://github.com/xtekky/tiktok-viewbot/blob/main/viewbot.py"
    click CLI_v2 "https://github.com/xtekky/tiktok-viewbot/blob/main/v2.py"

    %% Configuration Loader
    subgraph "Configuration Loader"
        CFG_json["config.json"]:::data
        CFG_old_json["old/v1/config.json"]:::data
        DEV_old["old/v1/devices.txt"]:::data
        PRO_old["old/v1/proxies.txt"]:::data
    end
    click CFG_json "https://github.com/xtekky/tiktok-viewbot/blob/main/config.json"
    click CFG_old_json "https://github.com/xtekky/tiktok-viewbot/blob/main/old/v1/config.json"
    click DEV_old "https://github.com/xtekky/tiktok-viewbot/blob/main/old/v1/devices.txt"
    click PRO_old "https://github.com/xtekky/tiktok-viewbot/blob/main/old/v1/proxies.txt"

    %% Core Engine
    subgraph "Core Engine"
        subgraph "Request Builder"
            RB1["viewbot.py"]:::python
            RB2["v2.py"]:::python
        end
        subgraph "Device Simulator"
            DS1["viewbot.py"]:::python
            DS2["v2.py"]:::python
        end
        subgraph "Proxy Manager"
            PM1["viewbot.py"]:::python
            PM2["v2.py"]:::python
        end
        Captcha["Captcha Solver"]:::python
    end
    click RB1 "https://github.com/xtekky/tiktok-viewbot/blob/main/viewbot.py"
    click RB2 "https://github.com/xtekky/tiktok-viewbot/blob/main/v2.py"
    click DS1 "https://github.com/xtekky/tiktok-viewbot/blob/main/viewbot.py"
    click DS2 "https://github.com/xtekky/tiktok-viewbot/blob/main/v2.py"
    click PM1 "https://github.com/xtekky/tiktok-viewbot/blob/main/viewbot.py"
    click PM2 "https://github.com/xtekky/tiktok-viewbot/blob/main/v2.py"
    click Captcha "https://github.com/xtekky/tiktok-viewbot/blob/main/v2.py"

    %% Network Layer
    subgraph "Network Layer"
        HTTP["TLS HTTP Client\n(tls_client + requests)"]:::python
    end
    click HTTP "https://github.com/xtekky/tiktok-viewbot/blob/main/v2.py"

    %% External Service
    Cloud["TikTok API"]:::external

    %% Optional Web Helper
    Optional["Web Helper\nzefoy/index.js"]:::js
    click Optional "https://github.com/xtekky/tiktok-viewbot/blob/main/zefoy/index.js"

    %% Test Harnesses
    subgraph "Test Harnesses"
        T1["test.py"]:::python
        T2["v2/test.py"]:::python
        T3["old/v2/test.py"]:::python
    end
    click T1 "https://github.com/xtekky/tiktok-viewbot/blob/main/test.py"
    click T2 "https://github.com/xtekky/tiktok-viewbot/blob/main/v2/test.py"
    click T3 "https://github.com/xtekky/tiktok-viewbot/blob/main/old/v2/test.py"

    %% Legacy Versions
    subgraph "Legacy Versions"
        L1["old/v1/viewbot.py"]:::python
        L2["old/v2/main.py"]:::python
        L3["old/v3/main.py"]:::python
    end
    click L1 "https://github.com/xtekky/tiktok-viewbot/blob/main/old/v1/viewbot.py"
    click L2 "https://github.com/xtekky/tiktok-viewbot/blob/main/old/v2/main.py"
    click L3 "https://github.com/xtekky/tiktok-viewbot/blob/main/old/v3/main.py"

    %% Data Flows
    CLI_main --> CFG_json
    CLI_main --> CFG_old_json
    CLI_main --> DEV_old
    CLI_main --> PRO_old
    CLI_v2 --> CFG_json
    CLI_v2 --> CFG_old_json
    CLI_v2 --> DEV_old
    CLI_v2 --> PRO_old

    CLI_main --> RB1
    CLI_v2 --> RB2

    RB1 --> DS1
    RB2 --> DS2

    DS1 --> PM1
    DS2 --> PM2

    PM1 --> RB1
    PM2 --> RB2

    RB1 --> HTTP
    RB2 --> HTTP

    HTTP --> Cloud
    HTTP --> Captcha
    Captcha --> RB2

    CLI_main --> Optional
    CLI_v2 --> Optional

    %% Styles
    classDef python fill:#DEF,stroke:#036,stroke-width:1px;
    classDef data fill:#FFE699,stroke:#AA7,stroke-width:1px;
    classDef external fill:#CFC,stroke:#292,stroke-width:1px;
    classDef js fill:#EFD,stroke:#E90,stroke-width:1px;
```
