An open API service indexing awesome lists of open source software.

https://github.com/marvin3dp/betlo

๐Ÿค– Automation bot with intelligent OCR & modern terminal UI. Multi-service support, headless mode, & human-like behavior.
https://github.com/marvin3dp/betlo

automation ocr python selenium tesseract

Last synced: about 1 month ago
JSON representation

๐Ÿค– Automation bot with intelligent OCR & modern terminal UI. Multi-service support, headless mode, & human-like behavior.

Awesome Lists containing this project

README

          

TikTok Bot Logo



### ๐Ÿš€ Advanced TikTok Services Automation

**Powerful bot with intelligent OCR captcha solver and modern terminal UI**

[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey.svg)](https://github.com)
[![Status](https://img.shields.io/badge/status-active-success.svg)](https://github.com)
[![OCR](https://img.shields.io/badge/OCR-Tesseract-orange.svg)](https://github.com/tesseract-ocr/tesseract)
![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/marvin3dp/betlo?utm_source=oss&utm_medium=github&utm_campaign=marvin3dp%2Fbetlo&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews)

[Features](#-features) โ€ข [Installation](#-installation) โ€ข [Usage](#-usage) โ€ข
[Configuration](#-configuration) โ€ข [Documentation](#-documentation) โ€ข
[FAQ](#-faq)

---

## ๐Ÿ“‹ Table of Contents

- [โœจ Features](#-features)
- [๐ŸŽฏ Supported Services](#-supported-services)
- [๐Ÿ“ธ Screenshots](#-screenshots)
- [๐Ÿš€ Installation](#-installation)
- [๐Ÿ’ก Usage](#-usage)
- [โš™๏ธ Configuration](#-configuration)
- [๐Ÿค– OCR Captcha Solver](#-ocr-captcha-solver)
- [๐Ÿ“Š Performance](#-performance)
- [๐Ÿ“š Documentation](#-documentation)
- [๐Ÿ› Troubleshooting](#-troubleshooting)
- [โ“ FAQ](#-faq)
- [๐Ÿค Contributing](#-contributing)
- [โš ๏ธ Disclaimer](#๏ธ-disclaimer)
- [๐Ÿ“œ License](#-license)

---

## โœจ Features

### ๐Ÿค– **Intelligent OCR Captcha Solver**

**FAST Mode** โšก

- 5 preprocessing methods
- 5 OCR configurations
- ~30 attempts per captcha
- Processing time: **10-20 seconds**
- 2 OCR retries before manual
- **Recommended for most users**

**AGGRESSIVE Mode** ๐ŸŒ

- Up to 12 preprocessing methods
- Up to 26 OCR configurations
- 300+ attempts per captcha
- Processing time: **3-5 minutes**
- 5 OCR retries before manual
- For difficult captchas

**Advanced Capabilities:**

- ๐Ÿ” **Horizontal Reading** - Leftโ†’Right like humans
- ๐ŸŽฏ **Uneven Text Handling** - Handles overlapping & naik-turun text
- ๐Ÿ“Š **Frequency-based Confidence Scoring** - Selects most reliable result
- ๐Ÿ› **Debug Mode** - Save all preprocessing steps for analysis
- ๐Ÿ–ผ๏ธ **Auto-Open Captcha** - Perfect for headless mode
- โ˜๏ธ **Cloud Upload** - Upload captcha to uploader.sh for easy VPS access
- ๐Ÿ”„ **Manual Input Fallback** - Never gets stuck

### ๐ŸŽจ **Modern Terminal UI**

- โœจ Beautiful rounded panels with Rich library
- ๐ŸŽฏ Interactive menus with questionary
- ๐Ÿ“Š Real-time statistics display
- โฑ๏ธ User-friendly uptime format (e.g., `4m 16s`)
- ๐ŸŽจ Colorful logs with emoji support
- ๐Ÿ“ˆ Progress bars and countdown timers
- ๐Ÿ–ฅ๏ธ Clean, centered messages

### ๐Ÿ›ก๏ธ **Advanced Bot Features**

- ๐Ÿ”„ **Intelligent Cooldown System** - 6 fallback points prevent rate limiting
- ๐ŸŽฏ **Target Goals & Progress Tracking** - Set targets and track automatically
- ๐ŸŒ **Headless Mode Support** - Run in background with auto-open captcha
- ๐ŸŽญ **Stealth Mode** - Advanced techniques to hide headless/automation
- ๐Ÿ–ฅ๏ธ **VPS Auto-Detection** - Auto-enable headless on servers (no display)
- ๐Ÿšซ **Advanced AdBlock** - DNS-based + Request interception
- ๐Ÿค– **Human-like Behavior** - Random delays, typing simulation
- ๐Ÿ’พ **Session Persistence** - Continue where you left off
- ๐Ÿงน **Auto Cleanup** - Chrome zombie process killer
- ๐Ÿ“ **Comprehensive Logging** - MAIN/DEBUG/INFO levels

### ๐ŸŽฏ **Service Management**

- โœ… Enable/disable services individually
- ๐ŸŽฏ Active service marker (visual indicator)
- ๐Ÿ“Š Live service status from Zefoy
- ๐Ÿ”„ Auto-retry on cooldown
- ๐Ÿ“ˆ Real-time progress tracking
- ๐ŸŽฏ Three execution modes:
- Manual Executions
- Target Amount
- Goal Mode (continuous)

---

## ๐ŸŽฏ Supported Services

| Service | Status | Rate Limit | Notes |
| ---------------------- | ---------- | ---------- | -------------- |
| โค๏ธ **Hearts** | โœ… Active | ~25/exec | Most reliable |
| ๐Ÿ‘๏ธ **Views** | โœ… Active | ~500/exec | High volume |
| ๐Ÿ”„ **Shares** | โœ… Active | ~50/exec | Fast cooldown |
| โญ **Favorites** | โœ… Active | ~100/exec | Stable |
| ๐Ÿ’ฌ **Comments Hearts** | โœ… Active | ~25/exec | Moderate |
| ๐Ÿ‘ฅ **Followers** | โš ๏ธ Offline | ~50/exec | Zefoy disabled |
| ๐Ÿ”ด **Live Stream** | โš ๏ธ Offline | ~50/exec | Zefoy disabled |

> **Note:** Service availability depends on Zefoy's status. Bot automatically
> detects and marks offline services.

---

## ๐Ÿ“ธ Screenshots

### Welcome Screen

```
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐Ÿ‘‹ Welcome โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ โ”‚
โ”‚ TikTok Automation Tool โ”‚
โ”‚ โ”‚
โ”‚ ๐Ÿš€ Automate TikTok engagement โ”‚
โ”‚ โœจ Multiple services support โ”‚
โ”‚ ๐ŸŽฏ Target goals & continuous mode โ”‚
โ”‚ โšก Real-time cooldown tracking โ”‚
โ”‚ โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
```

### Statistics Display

```
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐Ÿ“Š Bot Statistics โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ โ”‚
โ”‚ Uptime: 1h 23m 45s โ”‚
โ”‚ Captchas Solved: 15 โ”‚
โ”‚ Tasks Completed: 12 โ”‚
โ”‚ Tasks Failed: 0 โ”‚
โ”‚ โ”‚
โ”‚ Services Used: โ”‚
โ”‚ โ€ข Hearts: 8 โ”‚
โ”‚ โ€ข Views: 4 โ”‚
โ”‚ โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
```

### Captcha Solving

```
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐Ÿ” OCR Captcha Solver โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ โ”‚
โ”‚ โšก FAST Mode: 30 attempts in 10-20s โ”‚
โ”‚ ๐ŸŽฏ Horizontal reading enabled โ”‚
โ”‚ ๐Ÿ“Š Confidence scoring active โ”‚
โ”‚ โ”‚
โ”‚ [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 60% Complete โ”‚
โ”‚ โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
```

---

## ๐Ÿš€ Installation

### Prerequisites

**System Requirements:**

- Python 3.8 or higher
- Tesseract OCR
- Google Chrome or Chromium
- 2GB RAM minimum
- Linux, macOS, or Windows

### Step 1: Install System Dependencies

Ubuntu/Debian

```bash
sudo apt-get update
sudo apt-get install -y tesseract-ocr tesseract-ocr-eng
sudo apt-get install -y python3 python3-pip python3-venv
sudo apt-get install -y google-chrome-stable # or chromium-browser
```

macOS

```bash
brew install tesseract
brew install python3
brew install --cask google-chrome
```

Windows

1. Install [Python 3.8+](https://www.python.org/downloads/)
2. Install [Tesseract OCR](https://github.com/UB-Mannheim/tesseract/wiki)
3. Install [Google Chrome](https://www.google.com/chrome/)
4. Add Tesseract to PATH

### Step 2: Clone Repository

```bash
cd ~/Documents
git clone bots
cd bots
```

### Step 3: Install Python Dependencies

**Automated Installation (Recommended):**

```bash
chmod +x install.sh
./install.sh
```

The `install.sh` script will automatically:

- โœ“ Install `python3-venv` and `python3-full` (Debian/Ubuntu)
- โœ“ Install Google Chrome + dependencies
- โœ“ Create virtual environment
- โœ“ Install all Python packages
- โœ“ Setup required directories

**Manual Installation:**

```bash
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```

### ๐Ÿ–ฅ๏ธ VPS/Server Installation

For VPS or headless servers, use the **smart automated installer**:

```bash
./install.sh
```

**โœจ Smart Features:**
- ๐Ÿ” **Auto-detects** VPS/Server environment
- ๐Ÿ“ฆ **Auto-installs** Chrome + dependencies
- ๐Ÿ–ฅ๏ธ **Auto-installs** Xvfb (virtual display)
- โš™๏ธ **Auto-configures** for optimal performance

**Check VPS Environment:**

```bash
./check_vps.sh # Verify everything is configured correctly
```

**Important for VPS:**

- **โš ๏ธ Zefoy Detection Issue?** Use smart auto-detect for 95%+ reliability!
```bash
./venv.sh # Smart unified runner - auto-detects & uses Xvfb on VPS
```
- **Auto-detection:** Bot automatically enables Xvfb on VPS for best compatibility! ๐ŸŽ‰
- **Fallback:** Pure headless with stealth (60-80% success rate)
- Minimum 2GB RAM required
- /dev/shm should be >64MB (check with `df -h /dev/shm`)
- **Troubleshooting:** [ZEFOY_HEADLESS_FIX.md](docs/ZEFOY_HEADLESS_FIX.md)
- **Complete guide:** [VPS_SETUP.md](docs/VPS_SETUP.md)

**Key Dependencies:**

- `selenium` 4.15.2 - Browser automation
- `undetected-chromedriver` 3.5.5 - Anti-detection
- `pytesseract` 0.3.10 - OCR engine
- `opencv-python` 4.8.1.78 - Image processing
- `Pillow` 10.1.0 - Image manipulation
- `numpy` 1.26.4 - Numerical operations
- `PyYAML` 6.0.1 - Configuration
- `rich` 13.7.0 - Terminal UI
- `questionary` 2.0.1 - Interactive prompts

### Step 4: Configure

Edit `config.yaml` with your preferences:

```yaml
# Quick Start Configuration
captcha:
auto_solve: true # Enable OCR
fast_mode: true # Use FAST mode (recommended)
manual_input: true # Fallback to manual
auto_open_image: true # Auto-open captcha (local mode)
upload_to_cloud: false # Upload to uploader.sh (VPS mode)

browser:
headless: false # Set true for background mode
use_adblock: true # Block ads for faster loading

logging:
level: MAIN # Clean user-friendly logs
colorful: true # Colorful terminal output
```

### Step 5: Run

```bash
python run.py
```

Or with virtual environment:

```bash
source venv/bin/activate
python run.py
```

---

## ๐Ÿ’ก Usage

### Quick Start (Smart Auto-Detect) โญ **RECOMMENDED**

The **easiest way** - automatically detects your environment and chooses the best mode:

```bash
./venv.sh
```

**What it does:**
- โœ… **Desktop/Laptop** โ†’ Runs in visible mode (99% success)
- โœ… **VPS with Xvfb** โ†’ Uses virtual display (95%+ success)
- โœ… **VPS without Xvfb** โ†’ Auto-installs Xvfb or falls back to headless

This is the smartest way to run the bot - it picks the optimal mode for you!

### Manual Start

1. **Start the bot:**

```bash
python run.py
```

2. **From main menu, select:** `๐Ÿš€ Start Bot`

3. **Choose your service:** Hearts, Views, Shares, etc.

4. **Enter TikTok video URL**

5. **Select execution mode:**
- **Manual Executions** - Set number of times (e.g., 5 times)
- **Target Amount** - Set target count (e.g., 10,000 hearts)
- **Goal Mode** - Use targets from config

6. **Sit back and relax!** Bot handles everything automatically.

### Execution Modes Explained

**1. Manual Executions**

```
Execute service exactly N times
Example: "Run 5 times" โ†’ Executes 5 times then stops
Perfect for: Quick boosts, testing
```

**2. Target Amount**

```
Run until reaching specific amount
Example: "Get 10,000 hearts" โ†’ Runs until 10k reached
Perfect for: Specific goals, one-time campaigns
```

**3. Goal Mode**

```
Uses targets from config.yaml
Tracks progress across sessions
Perfect for: Long-term goals, continuous growth
```

### Interactive Menus

**Main Menu:**

- ๐Ÿš€ Start Bot
- โš™๏ธ Configure Settings
- ๐Ÿ“Š View Statistics
- ๐Ÿ“‹ View Available Services
- โ“ Help
- ๐Ÿšช Exit

**Settings Menu:**

- ๐ŸŒ Browser Settings (headless, adblock, user agent)
- โฑ๏ธ Timeout Settings
- ๐Ÿ” Captcha & OCR Settings (FAST/AGGRESSIVE modes)
- ๐Ÿ“ Logging Settings
- ๐ŸŽฏ Service Target Goals
- ๐Ÿ”Œ Enable/Disable Services

**Bot Running Menu:**

- โ–ถ๏ธ Execute Service
- ๐Ÿ“Š View Statistics (live session stats)
- ๐ŸŽฏ View Target Goals Progress
- ๐Ÿ”„ Refresh Page
- โ—€๏ธ Back to Main Menu

---

## โš™๏ธ Configuration

### Configuration File Structure

```yaml
# config.yaml - Complete configuration reference

browser:
headless: false # Run in background
use_adblock: true # Block ads (recommended)
disable_images: false # Disable images for speed
window_size: "1920,1080" # Browser resolution
user_agent: "Mozilla/5.0..." # Custom user agent

captcha:
auto_solve: true # Enable OCR
fast_mode: true # FAST mode (10-20s)
manual_input: true # Manual fallback
save_image: true # Save screenshots
auto_open_image: true # Auto-open (headless!)
debug_mode: false # Debug preprocessing

ocr_advanced: # AGGRESSIVE mode settings
horizontal_reading: true # Leftโ†’Right reading
handle_uneven_text: true # Uneven text support
aggressive_preprocessing: false # 12 methods vs 5
aggressive_ocr_configs: false # 26 configs vs 5

timeouts:
page_load: 30 # Page load timeout
element_wait: 10 # Element wait time
captcha_solve: 120 # Captcha timeout
between_actions: 2 # Action delays
retry_delay: 5 # Retry delay

retry:
auto_retry_on_cooldown: true # Auto-retry
max_attempts: 3 # Max retry attempts
on_captcha_fail: true # Retry on captcha fail

service_execution:
show_countdown: true # Show cooldown timer
active_service_only: false # Single service mode
default_target: 1 # Default target

service_targets: # Goal mode targets
hearts: 10000
views: 50000
followers: 1000
shares: 2000
favorites: 3000
comments_hearts: 5000
livestream: 500

per_execution: # Average per execution
hearts: 100
views: 1000
followers: 50
shares: 50
favorites: 100
comments_hearts: 50
livestream: 50

logging:
level: MAIN # MAIN/INFO/DEBUG
colorful: true # Colored output
save_to_file: true # Save to logs/

zefoy:
url: "https://zefoy.com"

services: # Service configuration
- name: "Hearts"
enabled: true
button_class: "t-hearts-button"

- name: "Views"
enabled: true
button_class: "t-views-button"

# ... more services

paths:
screenshots: "screenshots" # Screenshot folder
logs: "logs" # Log folder
extensions: "extensions" # Extensions folder
```

### Common Configuration Scenarios

Headless Mode (Background Operation)

```yaml
browser:
headless: true

captcha:
auto_solve: true
auto_open_image: true # Important for headless!
save_image: true
```

Maximum Speed

```yaml
browser:
headless: true
use_adblock: true
disable_images: true

captcha:
fast_mode: true # Quick OCR

timeouts:
between_actions: 1 # Minimal delays
```

Maximum Accuracy (Difficult Captchas)

```yaml
captcha:
auto_solve: true
fast_mode: false # AGGRESSIVE mode

ocr_advanced:
aggressive_preprocessing: true
aggressive_ocr_configs: true
horizontal_reading: true
handle_uneven_text: true
```

Debug Mode

```yaml
captcha:
debug_mode: true # Save all preprocessing

logging:
level: DEBUG # Verbose logging
```

---

## ๐Ÿค– OCR Captcha Solver

### How It Works

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Captcha โ”‚
โ”‚ Image โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Preprocessing (5-12 methods) โ”‚
โ”‚ โ€ข Line removal โ”‚
โ”‚ โ€ข Noise reduction โ”‚
โ”‚ โ€ข Contrast enhancement โ”‚
โ”‚ โ€ข Thresholding โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ OCR Engine (5-26 configs) โ”‚
โ”‚ โ€ข Tesseract LSTM โ”‚
โ”‚ โ€ข Multiple PSM modes โ”‚
โ”‚ โ€ข Horizontal reading โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Confidence Scoring โ”‚
โ”‚ โ€ข Frequency analysis โ”‚
โ”‚ โ€ข Length validation โ”‚
โ”‚ โ€ข Pattern detection โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Result โ”‚
โ”‚ (a-z,A-Z) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### FAST Mode vs AGGRESSIVE Mode

| Feature | FAST Mode โšก | AGGRESSIVE Mode ๐ŸŒ |
| ------------------- | ------------- | ------------------ |
| **Preprocessing** | 5 methods | Up to 12 methods |
| **OCR Configs** | 5 configs | Up to 26 configs |
| **Total Attempts** | ~30 | 300+ |
| **Processing Time** | 10-20 seconds | 3-5 minutes |
| **OCR Retries** | 2 retries | 5 retries |
| **Success Rate** | 70-85% | 75-90% |
| **Recommended For** | Most users | Difficult captchas |

### Preprocessing Methods

1. **Line Removal + Adaptive Threshold**
- Morphological operations to detect and remove lines
- Adaptive thresholding for varying lighting

2. **Morphological Line Removal + Otsu**
- Aggressive line detection with larger kernels
- Otsu's binarization for optimal threshold

3. **Bilateral Filter + CLAHE**
- Edge-preserving noise reduction
- Contrast Limited Adaptive Histogram Equalization

4. **Inverted + Line Removal**
- For light text on dark background
- Inverts colors before processing

5. **Median Blur + Line Removal**
- Salt-and-pepper noise removal
- Maintains edge sharpness

6. **Erosion-Dilation** _(AGGRESSIVE only)_
- Morphological operations
- Thick line handling

**+ 6 additional methods in AGGRESSIVE mode**

### OCR Configurations

**Page Segmentation Modes (PSM):**

- PSM 8 - Single word (most common)
- PSM 7 - Single line of text
- PSM 6 - Uniform block of text
- PSM 13 - Raw line (no dictionaries)
- PSM 10 - Single character

**OCR Engine Modes (OEM):**

- OEM 1 - LSTM only (neural network)
- OEM 3 - Legacy + LSTM (hybrid)

**+ 21 additional configs in AGGRESSIVE mode**

### Confidence Scoring

```python
# Scoring factors:
1. Length score (3-8 chars optimal)
2. Frequency count (same result multiple times)
3. Pattern detection (avoid repeated chars like "aaaa")
4. Character whitelist (a-z, A-Z only)

# Example:
Result "abCdEf" appears 5 times โ†’ High confidence โœ…
Result "aaaa" appears 3 times โ†’ Low confidence (pattern) โŒ
Result "ab12" appears 2 times โ†’ Invalid (numbers) โŒ
```

---

## ๐Ÿ“Š Performance

### Success Rates

| Captcha Type | FAST Mode | AGGRESSIVE Mode |
| ---------------- | --------- | --------------- |
| Clean text | 85-95% | 90-98% |
| With lines | 70-80% | 80-90% |
| Heavy noise | 50-65% | 65-80% |
| Overlapping text | 40-55% | 60-75% |
| Uneven text | 55-70% | 70-85% |

### Speed Comparison

| Mode | Processing Time | Total Attempts | Recommended Use |
| -------------- | --------------- | -------------- | ------------------------------------ |
| **FAST** | 10-20 seconds | ~30 | Daily use, most captchas |
| **AGGRESSIVE** | 3-5 minutes | 300+ | Difficult captchas, low success rate |

### System Performance

**Resource Usage:**

- CPU: 10-30% (during OCR processing)
- RAM: 200-500 MB
- Disk: ~10 MB for screenshots (with debug)

**Execution Speed:**

- Captcha solve: 10-20s (FAST) / 3-5min (AGGRESSIVE)
- Service execution: 5-10s
- Cooldown wait: 2-5 minutes (varies by service)
- Total per execution: 3-7 minutes average

---

## ๐Ÿ“š Documentation

### Main Documentation

| Document | Description |
| --------------------------------- | --------------------------- |
| [README.md](README.md) | This file - Complete guide |
| [CHANGELOG.md](docs/CHANGELOG.md) | Version history and updates |
| [LICENSE](LICENSE) | MIT License |

### Feature Guides

| Guide | Topic |
| ----------------------------------------------------------------- | ------------------------------- |
| [VPS_SETUP.md](docs/VPS_SETUP.md) | **VPS/Server setup guide** |
| [INSTALLATION.md](docs/INSTALLATION.md) | Detailed installation guide |
| [CHROME_TROUBLESHOOTING.md](docs/CHROME_TROUBLESHOOTING.md) | Chrome/ChromeDriver issues |
| [OCR_TROUBLESHOOTING.md](docs/OCR_TROUBLESHOOTING.md) | OCR debugging and optimization |
| [AGGRESSIVE_OCR_MODE.md](docs/AGGRESSIVE_OCR_MODE.md) | AGGRESSIVE mode detailed guide |
| [DISPLAY_MODES.md](docs/DISPLAY_MODES.md) | **Display modes comparison** โญ |
| [HEADLESS_MODE_GUIDE.md](docs/HEADLESS_MODE_GUIDE.md) | Running in headless mode |
| [HEADLESS_STEALTH.md](docs/HEADLESS_STEALTH.md) | Stealth mode details |
| [ZEFOY_HEADLESS_FIX.md](docs/ZEFOY_HEADLESS_FIX.md) | Fix Zefoy detection (Xvfb) |
| [ZEFOY_DETECTION_FIX.md](docs/ZEFOY_DETECTION_FIX.md) | **Captcha not detected fix** โš ๏ธ |
| [VPS_CDP_FIX.md](docs/VPS_CDP_FIX.md) | **Runtime.evaluate error** โš ๏ธ |
| [CDP_ERROR_FINAL_FIX.md](docs/CDP_ERROR_FINAL_FIX.md) | **CDP error suppression** โœ… |
| [STUCK_HEADLESS_FIX.md](docs/STUCK_HEADLESS_FIX.md) | **Bot stuck/timeout fix** โœ… |
| [FINAL_FIXES_v2.md](docs/FINAL_FIXES_v2.md) | **All comprehensive fixes** ๐Ÿ“š |
| [FIXES_SUMMARY.md](docs/FIXES_SUMMARY.md) | **Quick fixes summary** ๐Ÿ“‹ |
| [AUTO_OPEN_CAPTCHA_FEATURE.md](docs/AUTO_OPEN_CAPTCHA_FEATURE.md) | Auto-open captcha feature |
| [COOLDOWN.md](docs/COOLDOWN.md) | Cooldown system explained |

### Quick References

| Reference | Link |
| ---------------------- | ---------------------------------------- |
| Installation Help | See [Installation](#-installation) |
| Configuration Examples | See [Configuration](#-configuration) |
| FAQ | See [FAQ](#-faq) |
| Troubleshooting | See [Troubleshooting](#-troubleshooting) |

---

## ๐Ÿ› Troubleshooting

### Common Issues

โŒ OCR keeps failing / Low success rate

**Solutions:**

1. **Enable Debug Mode:**

```yaml
captcha:
debug_mode: true
logging:
level: DEBUG
```

2. **Check Screenshots:**
- Look in `screenshots/` folder
- Check preprocessing quality
- Verify text is readable

3. **Try AGGRESSIVE Mode:**

```yaml
captcha:
fast_mode: false
ocr_advanced:
aggressive_preprocessing: true
aggressive_ocr_configs: true
```

4. **Enable Manual Fallback:**
```yaml
captcha:
manual_input: true
```

**See:** [docs/OCR_TROUBLESHOOTING.md](docs/OCR_TROUBLESHOOTING.md)

โŒ Chrome not found / ChromeDriver error

**Solutions:**

1. **Install Chrome:**

```bash
# Ubuntu/Debian
sudo apt-get install google-chrome-stable

# macOS
brew install --cask google-chrome
```

2. **Clean Chrome Processes:**

```bash
chmod +x fix_chrome.sh
./fix_chrome.sh
```

3. **Update ChromeDriver:**
```bash
pip install --upgrade undetected-chromedriver
```

**See:** [docs/CHROME_TROUBLESHOOTING.md](docs/CHROME_TROUBLESHOOTING.md)

โŒ Service on cooldown constantly

**This is normal!** Services have cooldowns:

- First execution: No cooldown
- After success: 2-5 minutes cooldown
- Bot waits automatically

**Enable auto-retry:**

```yaml
retry:
auto_retry_on_cooldown: true
```

**See:** [docs/COOLDOWN.md](docs/COOLDOWN.md)

โŒ Headless mode - Can't see captcha

**Solution - Auto-open feature:**

```yaml
browser:
headless: true

captcha:
save_image: true
auto_open_image: true # โ† This opens captcha automatically!
```

Bot will open captcha image with default viewer automatically!

**See:** [docs/HEADLESS_MODE_GUIDE.md](docs/HEADLESS_MODE_GUIDE.md)

โŒ Tesseract not found

**Install Tesseract:**

```bash
# Ubuntu/Debian
sudo apt-get install tesseract-ocr tesseract-ocr-eng

# macOS
brew install tesseract

# Windows
# Download from: https://github.com/UB-Mannheim/tesseract/wiki
# Add to PATH after installation
```

**Verify installation:**

```bash
tesseract --version
```

โŒ Bot crashes / Freezes

**Solutions:**

1. **Check logs:**

```bash
tail -f logs/betlo_*.log
```

2. **Clean Chrome:**

```bash
./fix_chrome.sh
```

3. **Restart with DEBUG:**

```yaml
logging:
level: DEBUG
```

4. **Check system resources:**
- Ensure 2GB+ RAM available
- Close other Chrome instances

### Getting Help

1. **Check logs:** `logs/betlo_YYYYMMDD.log`
2. **Enable DEBUG mode:** Set `logging.level: DEBUG`
3. **Check documentation:** See [docs/](docs/) folder
4. **Review FAQ:** See [FAQ](#-faq) section below

---

## โ“ FAQ

### General Questions

**Q: Is this safe to use?** A: The bot uses undetected-chromedriver and
human-like behavior to minimize detection. However, use at your own risk and
follow TikTok/Zefoy ToS.

**Q: Do I need a Zefoy account?** A: No, Zefoy doesn't require accounts. Just
visit the website and use services.

**Q: Can I run multiple instances?** A: Not recommended. Running multiple
instances may cause conflicts and increase detection risk.

**Q: Does this work on mobile?** A: No, this is a desktop application requiring
Python and Chrome.

### OCR Questions

**Q: What's the difference between FAST and AGGRESSIVE mode?** A: FAST mode is
faster (10-20s) with good accuracy (70-85%). AGGRESSIVE mode is slower (3-5min)
but more thorough (75-90%). Use FAST for daily use, AGGRESSIVE for difficult
captchas.

**Q: Can I train my own OCR model?** A: Not currently. The bot uses Tesseract
OCR which is pre-trained. You can adjust preprocessing methods in the code.

**Q: OCR never works, should I disable it?** A: Don't disable! Instead, enable
`manual_input: true` for fallback. This way OCR tries first, manual as backup.

### Configuration Questions

**Q: How do I run in background?** A: Set `browser.headless: true` and
`captcha.auto_open_image: true` in config.yaml

**Q: Can I customize service targets?** A: Yes! Edit `service_targets` section
in config.yaml

**Q: How do I enable only specific services?** A: Use Settings menu โ†’
Enable/Disable Services, or edit config.yaml

### Troubleshooting Questions

**Q: Service shows "OFFLINE", what to do?** A: This means Zefoy has disabled the
service. Wait for Zefoy to re-enable it. You can still try to use it, but it may
not work.

**Q: Cooldown is too long, can I skip it?** A: No, cooldowns are enforced by
Zefoy. Skipping would cause errors. Enable `show_countdown: true` to see
countdown timer.

**Q: Statistics not showing, why?** A: Statistics show when bot is running. From
main menu, it shows last session data from `target_progress.json`. Execute some
services first!

---

## ๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

### Areas for Improvement

- ๐ŸŽฏ Additional preprocessing methods for OCR
- ๐Ÿ“Š Better confidence scoring algorithms
- ๐ŸŒ Support for other captcha types
- โšก Performance optimizations
- ๐ŸŽจ UI/UX improvements
- ๐Ÿ“ Documentation improvements
- ๐ŸŒ Internationalization (i18n)

### How to Contribute

1. **Fork the repository**
2. **Create a feature branch:** `git checkout -b feature/amazing-feature`
3. **Make your changes**
4. **Test thoroughly**
5. **Commit:** `git commit -m 'Add amazing feature'`
6. **Push:** `git push origin feature/amazing-feature`
7. **Open a Pull Request**

### Code Style

- Follow PEP 8 for Python code
- Use type hints where possible
- Add docstrings to functions
- Comment complex logic
- Keep functions focused and small

### Testing

- Test on multiple platforms (Linux, macOS, Windows)
- Test with different captcha types
- Verify no regressions in existing features
- Check for linter errors

---

## โš ๏ธ Disclaimer

### Educational Purpose Only

This bot is created for **educational and research purposes only**. By using
this software, you acknowledge that:

- โš–๏ธ You will use it **responsibly and ethically**
- ๐Ÿ“œ You understand the **risks and consequences**
- โœ… You will **comply with all applicable laws** and Terms of Service
- ๐Ÿšซ You will **not use it for spam, abuse, or commercial purposes** without
permission
- ๐Ÿ‘ค You take **full responsibility** for your actions

### Legal Notice

- This software is provided "AS IS" without warranties
- Authors are not responsible for misuse or damages
- Not affiliated with TikTok or Zefoy
- Users must comply with TikTok and Zefoy Terms of Service
- Automated interactions may violate platform policies

### Use at Your Own Risk

- Account bans or restrictions are possible
- Service availability depends on Zefoy
- Results are not guaranteed
- No warranty or support guarantee

**By using this software, you agree to these terms.**

---

## ๐Ÿ“œ License

This project is licensed under the **MIT License** - see the [LICENSE](LICENSE)
file for details.

### MIT License Summary

โœ… **Permissions:**

- Commercial use
- Modification
- Distribution
- Private use

โŒ **Limitations:**

- Liability
- Warranty

๐Ÿ“‹ **Conditions:**

- License and copyright notice must be included

---

## ๐Ÿ™ Credits & Acknowledgments

This project uses the following open-source libraries:

### Core Dependencies

- [Tesseract OCR](https://github.com/tesseract-ocr/tesseract) - Optical
character recognition engine
- [OpenCV](https://opencv.org/) - Image processing library
- [Selenium](https://www.selenium.dev/) - Browser automation framework
- [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver) -
Anti-detection Chrome driver

### UI & Utilities

- [Rich](https://github.com/Textualize/rich) - Beautiful terminal formatting
- [Questionary](https://github.com/tmbo/questionary) - Interactive CLI prompts
- [PyYAML](https://pyyaml.org/) - YAML configuration parser
- [Pillow](https://python-pillow.org/) - Image manipulation
- [NumPy](https://numpy.org/) - Numerical operations

### Special Thanks

- The open-source community for amazing tools
- Tesseract OCR team for powerful OCR engine
- Contributors and users of this project

---

## ๐Ÿ†• What's New in v3.0.0

### October 23, 2025 Update - Major Release

#### ๐Ÿ”„ BREAKING CHANGE: Package Renamed to Betlo

- **Package renamed** from `zefoy_bot` to `betlo`
- Import changes: `from zefoy_bot.main` โ†’ `from betlo.main`
- Log files: `zefoy_bot_*.log` โ†’ `betlo_*.log`
- Module path: `python -m zefoy_bot` โ†’ `python -m betlo`
- All 37 files updated with new package name
- Complete documentation updated across all files

#### โšก 10-60x Faster Commits with Optimized Pre-commit

- **Commit speed improved dramatically**
- Before: 2-5 minutes (waiting for Node.js/Go installation)
- After: 2-5 seconds for normal commits โšก
- **Two-tier approach**
- Fast hooks: Run automatically on every commit (2-5 seconds)
- Slow hooks: Run manually before push (2-5 minutes)
- **Smart hook staging**
- Markdown linter โ†’ manual only (was slow)
- YAML formatter โ†’ manual only (was slow)
- Shell formatter โ†’ manual only (was slow)
- Python formatters โ†’ auto-run, scoped to `betlo/*.py`

- **New documentation**
- `PRE_COMMIT_GUIDE.md` - Complete usage guide
- Learn how to run fast commits and full checks

#### ๐Ÿ“ Migration Guide

**Update your imports:**

```python
# OLD
from zefoy_bot.main import main
import zefoy_bot

# NEW
from betlo.main import main
import betlo
```

**Quick steps:**

1. Pull latest changes: `git pull`
2. Update imports in your code
3. Reinstall pre-commit: `pre-commit install`
4. Enjoy faster commits! ๐Ÿš€

**See [CHANGELOG.md](docs/CHANGELOG.md) for complete version history**

---

## ๐Ÿ“ž Support & Contact

### Documentation

- ๐Ÿ“– [Full Documentation](docs/)
- ๐Ÿ“ [Changelog](docs/CHANGELOG.md)
- โ“ [FAQ](#-faq)
- ๐Ÿ› [Troubleshooting](#-troubleshooting)

### Resources

- ๐Ÿ’ป [GitHub Repository](https://github.com)
- ๐Ÿ“Š [Issue Tracker](https://github.com/issues)
- ๐Ÿ’ฌ [Discussions](https://github.com/discussions)

---

### โญ Star this project if you find it useful!

**Made with โค๏ธ by the community**

---

**Last Updated:** October 30, 2025 **Current Version:** 4.0.0 - Package Renamed
to Betlo & Optimized Pre-commit

**[โ†‘ Back to Top](#-table-of-contents)**