A powerful web scraper for Como TV content with Telegram bot control
Features β’ Quick Start β’ Documentation β’ Telegram Bot
|
|
- β Multi-threading (4 parallel workers for 4x speed)
- β Proxy support (HTTP/HTTPS) with authentication
- β 3x retry mechanism for all requests (SSLError, Timeout, etc.)
- β Duplicate removal & data cleaning
- β Fancy progress bar with live stats & ETA
- β CSV export with custom fields
- β Environment-based configuration (.env)
- β Error handling & logging
# Clone repository
git clone https://github.com/Veloruze/como-tv-scraper.git
cd como-tv-scraper
# Install dependencies
pip install -r requirements.txtCreate .env file from template:
cp .env.example .envEdit .env with your settings:
# Telegram Bot (optional - only if using bot)
TELEGRAM_BOT_TOKEN=your_bot_token_here
# Proxy Configuration
PROXY_URL=http://username:password@proxy.com:port
PROXY_ENABLED=true
# Scraper Settings
LANGUAGE_CODE=it-IT
CATEGORY_START=1
CATEGORY_END=1000
MAX_WORKERS=4# Scrape categories
python como_tv_scraper.py
# Clean data (remove duplicates)
python clean_data.py
# Scrape details
python detail_scraper.pyControl everything from Telegram with an interactive bot interface!
-
Create Bot
- Open Telegram β Search
@BotFather - Send
/newbotand follow instructions - Copy the bot token
- Open Telegram β Search
-
Configure
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
-
Run Bot
python telegram_bot.py
| Command | Description |
|---|---|
/start |
Show main menu with interactive buttons |
/setlang <code> |
Set language (it-IT or en_US) |
/setproxy <url> |
Configure proxy URL |
/setrange <start> <end> |
Set category range |
/toggleproxy |
Enable/disable proxy |
π Scrape Categories β Scrape all categories
π Scrape Details β Get detailed content info
π§Ή Clean Data β Remove duplicates
π Status β Check scraping progress
βοΈ Settings β View configuration
π₯ Download β Get CSV files
graph LR
A[π Scrape Categories] --> B[π§Ή Clean Data]
B --> C[π Scrape Details]
C --> D[π₯ Download Results]
Scrapes content from categories with pagination support.
from como_tv_scraper import ComoTVScraper, ScraperConfig
# Auto-load from .env
config = ScraperConfig()
scraper = ComoTVScraper(config)
# Scan categories
scraper.scan_all_categories(
start_id=1,
end_id=1000,
output_file="output/all_categories.csv"
)Output: categoryId, categoryName, title, contentId
Fetches detailed information for each content item.
from detail_scraper import ComoTVDetailScraper, load_content_ids_from_csv
# Load config from .env
scraper = ComoTVDetailScraper()
# Load content IDs from categories
content_ids = load_content_ids_from_csv("output/all_categories_cleaned.csv")
# Scrape details
scraper.scrape_multiple_details(
content_ids=content_ids,
output_file="output/content_details.csv"
)Output: contentId, name, type, templateModel, area, contentGrade, description, duration, categoryName, watermarkId, RelatedCount, Related1-10
Remove duplicates and empty rows automatically.
from clean_data import clean_categories_csv, clean_details_csv
# Clean category data
clean_categories_csv()
# Clean details data
clean_details_csv()| Variable | Default | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
- | Telegram bot token from @BotFather |
PROXY_URL |
- | Proxy URL with credentials |
PROXY_ENABLED |
true |
Enable/disable proxy |
LANGUAGE_CODE |
it-IT |
API language (see Language Options below) |
CATEGORY_START |
1 |
Start category ID |
CATEGORY_END |
1000 |
End category ID |
MAX_WORKERS |
4 |
Number of parallel threads (1-10 recommended) |
http://username:password@host:port
Example:
http://user123-country-it:pass456@proxy.com:6060
| Code | Language | Status | Notes |
|---|---|---|---|
it-IT |
Italian (Italy) | β Recommended | Excellent data quality, best results |
en_US |
English (US) | Poor/no data availability |
Note: Como TV is Italy-based, so Italian language provides the most comprehensive content.
como-tv-scraper/
βββ π como_tv_scraper.py # Category scraper
βββ π detail_scraper.py # Detail scraper
βββ π clean_data.py # Data cleaning utility
βββ π€ telegram_bot.py # Telegram bot interface
βββ π requirements.txt # Python dependencies
βββ π§ .env.example # Configuration template
βββ π README.md # This file
βββ π output/ # Output directory
βββ all_categories.csv # Raw category data
βββ all_categories_cleaned.csv # Cleaned categories
βββ content_details.csv # Raw details
βββ content_details_cleaned.csv # Cleaned details
Connection Errors / Timeouts
- β Script auto-retries 3x with 5s delay
- β Increase timeout in scraper config
- β Check proxy connection
- β Verify internet stability
Proxy Not Working
- β Verify proxy URL format
- β
Test proxy:
curl -x http://user:pass@proxy:port https://google.com - β Check proxy credentials
- β
Try disabling proxy:
PROXY_ENABLED=false
Telegram Bot Not Responding
- β
Verify token in
.envfile - β
Check bot is running:
python telegram_bot.py - β
Ensure
.envfile exists and formatted correctly - β Check internet connection
No Data Found
- β
Verify language code (
it-ITworks best) - β Check proxy is working (timeout = no data)
- β Try different category range
- β Increase timeout to 60s
Starting scan of categories 1 to 1000...
Proxy enabled: True
Language: it-IT
[206/1000] Scanning category 206...
Scraping page 0...
Scraping page 1...
Found 45 items
==================================================
SCAN COMPLETE!
==================================================
Total categories scanned: 1000
Successful: 127
Failed/Empty: 873
Total items collected: 4,325
Output file: output/all_categories.csv
==================================================
Scraping content details with 4 workers...
100%|ββββββββββββββββββββ| 4325/4325 [1:23:45<00:00, 51.67it/s]
Results:
β Successful: 4,312
β Failed: 13
π Total: 4,325
Output saved to: output/content_details.csv
β οΈ Important Security Notes
- π NEVER commit
.envfile to git (already in.gitignore) - π NEVER share your Telegram bot token publicly
- π Keep proxy credentials secure
- π Use
.env.exampleas template only (no real credentials)
- Python 3.8 or higher
requests >= 2.31.0python-telegram-bot >= 20.0(for bot only)python-dotenv >= 1.0.0tqdm >= 4.66.0(for progress bars)
MIT License - see LICENSE file for details
Contributions are welcome! Feel free to:
- π Report bugs
- π‘ Suggest features
- π§ Submit pull requests
Made with β€οΈ using Python