2.0.0 refactor

This commit is contained in:
Yami Odymel
2025-05-02 23:52:58 +08:00
parent cad4689a5c
commit f26602b49e
51 changed files with 2108 additions and 2989 deletions

311
README.md
View File

@@ -1,154 +1,182 @@
# Chaturbate DVR
The program can records **multiple** Chaturbate streams, supports macOS, Windows, Linux, can be run on Docker.
A tool to record **multiple** Chaturbate streams. Supports macOS, Windows, Linux, and Docker.
For Chaturbate-**only**, private/ticket stream is **unsupported**.
![Image](https://github.com/user-attachments/assets/d71f0aaa-e821-4371-9f48-658a137b42b6)
**[DMCA WARNING](https://www.dmca.com/)**: Contents on Chaturbate are copyrighted, you should not copy, share, distribute the content.
![Image](https://github.com/user-attachments/assets/43ab0a07-0ece-40ba-9a0f-045ca0316638)
 
## Usage
# Getting Started
Download executable from **[Release](https://github.com/teacat/chaturbate-dvr/releases)** page (e.g., `windows_chatubrate-dvr.exe`).
Go to the [📦 Releases page](https://github.com/teacat/chaturbate-dvr/releases) and download the appropriate binary. (e.g., `x64_windows_chatubrate-dvr.exe`)
 
**🌐 Start the program with the Web UI**
Visit [`http://localhost:8080`](http://localhost:8080) to use the Web UI.
```yaml
# Windows (or double-click `chaturbate-dvr.exe` to open)
$ chaturbate-dvr.exe
# macOS or Linux
$ chaturbate-dvr
```
 
**💻 or... Run as a command-line tool**
Run the program with a channel name (`-u CHANNEL_USERNAME`) records the channel immediately, and the Web UI will be disabled.
```yaml
# Windows
$ chaturbate-dvr.exe -u CHANNEL_USERNAME
# macOS or Linux
$ chaturbate-dvr -u CHANNEL_USERNAME
```
 
## Preview
![image_1](https://github.com/teacat/chaturbate-dvr/assets/7308718/c6d17ffe-eba7-4296-9315-f501489d85f3)
![image_2](https://github.com/teacat/chaturbate-dvr/assets/7308718/d02923e0-574d-4a15-a373-8b0599101e3f)
**or... Command-line tool**
```
$ ./chaturbate-dvr -u emillybrowm start
██████╗██╗ ██╗ █████╗ ████████╗██╗ ██╗██████╗ ██████╗ █████╗ ████████╗███████╗
██╔════╝██║ ██║██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝
██║ ███████║███████║ ██║ ██║ ██║██████╔╝██████╔╝███████║ ██║ █████╗
██║ ██╔══██║██╔══██║ ██║ ██║ ██║██╔══██╗██╔══██╗██╔══██║ ██║ ██╔══╝
╚██████╗██║ ██║██║ ██║ ██║ ╚██████╔╝██║ ██║██████╔╝██║ ██║ ██║ ███████╗
╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝
██████╗ ██╗ ██╗██████╗
██╔══██╗██║ ██║██╔══██╗
██║ ██║██║ ██║██████╔╝
██║ ██║╚██╗ ██╔╝██╔══██╗
██████╔╝ ╚████╔╝ ██║ ██║
╚═════╝ ╚═══╝ ╚═╝ ╚═╝
[2024-01-24 00:11:54] [INFO] [emillybrowm] channel created
[2024-01-24 00:11:55] [INFO] [emillybrowm] channel is online, start fetching...
[2024-01-24 00:11:55] [INFO] [emillybrowm] the stream will be saved as videos/emillybrowm_2024-01-24_00-11-55.ts
[2024-01-24 00:11:55] [INFO] [emillybrowm] resolution 1080p is used
[2024-01-24 00:11:55] [INFO] [emillybrowm] framerate 30fps is used
[2024-01-24 00:11:57] [INFO] [emillybrowm] segment #0 written
[2024-01-24 00:11:57] [INFO] [emillybrowm] segment #1 written
[2024-01-24 00:11:57] [INFO] [emillybrowm] segment #2 written
```
 
## Help
## 🌐 Launching the Web UI
```bash
$ chaturbate-dvr -h
# Windows
$ x64_windows_chatubrate-dvr.exe
NAME:
chaturbate-dvr - Records your favorite Chaturbate stream 😎🫵
# macOS / Linux
$ ./x64_linux_chatubrate-dvr
```
USAGE:
chaturbate-dvr [global options] command [command options]
Then visit [`http://localhost:8080`](http://localhost:8080) in your browser.
VERSION:
1.0.0
 
COMMANDS:
help, h Shows a list of commands or help for one command
## 💻 Using as a CLI Tool
GLOBAL OPTIONS:
--username value, -u value channel username to record
--gui-username value, --gui-u value username for auth web (optional)
--gui-password value, --gui-p value password for auth web (optional)
--framerate value, -f value preferred framerate (default: 30)
--interval value, -i value minutes to check if the channel is online (default: 1)
--resolution value, -r value preferred resolution (default: 1080)
--resolution-fallback value, --rf value fallback to 'up' (larger) or 'down' (smaller) resolution if preferred resolution is not available (default: "down")
--filename-pattern value, --fp value filename pattern for videos (default: "videos/{{.Username}}_{{.Year}}-{{.Month}}-{{.Day}}_{{.Hour}}-{{.Minute}}-{{.Second}}{{if .Sequence}}_{{.Sequence}}{{end}}")
--split-duration value, --sd value minutes to split each video into segments ('0' to disable) (default: 0)
--split-filesize value, --sf value size in MB to split each video into segments ('0' to disable) (default: 0)
--log-level value log level, availables: 'DEBUG', 'INFO', 'WARN', 'ERROR' (default: "INFO")
--port value port to expose the web interface and API (default: "8080")
--cf-cookie value Cloudflare cookie to bypass anti-bot page
--user-agent value Custom user agent for when using cf-cookie
--help, -h show help
--version, -v print the version
```bash
# Windows
$ x64_windows_chatubrate-dvr.exe -u CHANNEL_USERNAME
# macOS / Linux
$ ./x64_linux_chatubrate-dvr -u CHANNEL_USERNAME
```
This starts recording immediately. The Web UI will be disabled.
 
## 🐳 Running with Docker
Pre-built image `yamiodymel/chaturbate-dvr` from [Docker Hub](https://hub.docker.com/r/yamiodymel/chaturbate-dvr):
```bash
# Run the container and save videos to ./videos
$ docker run -d \
--name my-dvr \
-p 8080:8080 \
-v "./videos:/usr/src/app/videos" \
-v "./conf:/usr/src/app/conf" \
yamiodymel/chaturbate-dvr
```
...Or build your own image using the Dockerfile in this repository.
```bash
# Build the image
$ docker build -t chaturbate-dvr .
# Run the container and save videos to ./videos
$ docker run -d \
--name my-dvr \
-p 8080:8080 \
-v "./videos:/usr/src/app/videos" \
-v "./conf:/usr/src/app/conf" \
chaturbate-dvr
```
...Or use [`docker-compose.yml`](https://github.com/teacat/chaturbate-dvr/blob/master/docker-compose.yml):
```bash
$ docker-compose up
```
Then visit [`http://localhost:8080`](http://localhost:8080) in your browser.
 
# 🧾 Command-Line Options
Available options:
```
--username value, -u value The username of the channel to record
--admin-username value Username for web authentication (optional)
--admin-password value Password for web authentication (optional)
--framerate value Desired framerate (FPS) (default: 30)
--resolution value Desired resolution (e.g., 1080 for 1080p) (default: 1080)
--pattern value Template for naming recorded videos (default: "videos/{{.Username}}_{{.Year}}-{{.Month}}-{{.Day}}_{{.Hour}}-{{.Minute}}-{{.Second}}{{if .Sequence}}_{{.Sequence}}{{end}}")
--max-duration value Split video into segments every N minutes ('0' to disable) (default: 0)
--max-filesize value Split video into segments every N MB ('0' to disable) (default: 0)
--port value, -p value Port for the web interface and API (default: "8080")
--interval value Check if the channel is online every N minutes (default: 1)
--cookies value Cookies to use in the request (format: key=value; key2=value2)
--user-agent value Custom User-Agent for the request
--domain value Chaturbate domain to use (default: "https://chaturbate.global/")
--help, -h show help
--version, -v print the version
```
**Examples**:
```yaml
# Records in 720p/60fps
$ chaturbate-dvr -u yamiodymel -r 720 -f 60
```bash
# Record at 720p / 60fps
$ ./chatubrate-dvr -u yamiodymel -resolution 720 -framerate 60
# Split the video every 30 minutes
$ chaturbate-dvr -u yamiodymel -sd 30
# Split every 30 minutes
$ ./chatubrate-dvr -u yamiodymel -max-duration 30
# Split the video every 1024 MB
$ chaturbate-dvr -u yamiodymel -sf 1024
# Split at 1024 MB
$ ./chatubrate-dvr -u yamiodymel -max-filesize 1024
# Change output filename pattern
$ chaturbate-dvr -u yamiodymel -fp video/{{.Username}}/{{.Year}}-{{.Month}}-{{.Day}}_{{.Hour}}-{{.Minute}}-{{.Second}}_{{.Sequence}}
# Custom filename format
$ ./chatubrate-dvr -u yamiodymel \
-pattern "video/{{.Username}}/{{.Year}}-{{.Month}}-{{.Day}}_{{.Hour}}-{{.Minute}}-{{.Second}}_{{.Sequence}}"
```
※ When runs in Web UI mode, the settings will be default settings for Web UI to create channels.
_Note: In Web UI mode, these flags serve as default values for new channels._
 
## 📺 Framerate & Resolution / Fallback
# 🍪 Cookies & User-Agent
Fallback indicates what to do when there's no expected target resolution, situation:
You can set Cookies and User-Agent via the Web UI or command-line arguments.
```
Availables: 1080p, 720p, 240p
![localhost_8080_ (4)](https://github.com/user-attachments/assets/cbd859a9-4255-404b-b6bf-fa89342f7258)
Resolution: 480p (fallback setted to: up)
Result: 720p will be used
Resolution: 480p (fallback setted to: down)
Result: 240p will be used
```
_Note: Use semicolons to separate multiple cookies, e.g., `key1=value1; key2=value2`._
 
## 📄 Filename Pattern
## ☁️ Bypass Cloudflare
1. Open [Chaturbate](https://chaturbate.com) in your browser and complete the Cloudflare check.
(Keep refresh with F5 if the check doesn't appear)
2. **DevTools (F12)****Application****Cookies**`https://chaturbate.com` → Copy the `cf_clearance` value
![sshot-2025-04-30-146](https://github.com/user-attachments/assets/69f4061b-29a2-48a7-ad57-0c86148805e2)
3. User-Agent can be found using [WhatIsMyBrowser](https://www.whatismybrowser.com/detect/what-is-my-user-agent/), now run with `-cookies` and `-user-agent`:
```bash
$ ./chatubrate-dvr -u yamiodymel \
-cookies "cf_clearance=PASTE_YOUR_CF_CLEARANCE_HERE" \
-user-agent "PASTE_YOUR_USER_AGENT_HERE"
```
Example:
```bash
$ ./chatubrate-dvr -u yamiodymel \
-cookies "cf_clearance=i975JyJSMZUuEj2kIqfaClPB2dLomx3.iYo6RO1IIRg-1746019135-1.2.1.1-2CX..." \
-user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."
```
 
## 🕵️ Record Private Shows
1. Login [Chaturbate](https://chaturbate.com) in your browser.
2. **DevTools (F12)** → **Application** → **Cookies** → `https://chaturbate.com` → Copy the `sessionid` value
3. Run with `-cookies`:
```bash
$ ./chatubrate-dvr -u yamiodymel -cookies "sessionid=PASTE_YOUR_SESSIONID_HERE"
```
 
# 📄 Filename Pattern
The format is based on [Go Template Syntax](https://pkg.go.dev/text/template), available variables are:
@@ -179,58 +207,39 @@ Pattern: video/{{.Username}}/{{.Year}}-{{.Month}}-{{.Day}}_{{.Hour}}-{{.Minute}}
Output: video/yamiodymel/2024-01-02_13-45-00_0.ts
```
※ The file will be saved as `.ts` format and it's not configurable.
_Note: Files are saved in `.ts` format, and this is not configurable._
 
## 🤔 Frequently Asked Questions
# 🤔 Frequently Asked Questions
**Q: The program closes itself when I just open it on Windows**
**Q: The program closes immediately on Windows.**
A: Try to open the program in **Command Prompt**, the error message should appear, and create a new [Issue](https://github.com/teacat/chaturbate-dvr/issues) for it.
> Open it via **Command Prompt**, the error message should appear. If needed, [create an issue](https://github.com/teacat/chaturbate-dvr/issues).
 
**Q: Channel is online but the program says it's Offline**
**Q: Error `listen tcp :8080: bind: An attempt was... by its access permissions`**
A: The program might be blocked by Chaturbate or Cloudflare. If the Channel is in a private/ticket show, the program doesn't support it yet.
> The port `8080` is in use. Try another port with `-p 8123`, then visit [http://localhost:8123](http://localhost:8123).
>
> If that fails, run **Command Prompt** as Administrator and execute:
>
> ```bash
> $ net stop winnat
> $ net start winnat
> ```
 
**Q: `listen tcp :8080: bind: An attempt was made to access a socket in a way forbidden by its access permissions.`**
**Q: Error `A connection attempt failed... host has failed to respond`**
A: The port `8080` is already in use, change the port with `-port` option (e.g. `-port 8123`) and visit `http://localhost:8123`.
If the error still occur, run **Command Prompt** as Administrator, and type `net stop winnat` then `net start winnat`, and re-run the Chaturbate DVR again.
> Likely a network issue (e.g., VPN, firewall, or blocked by Chaturbate). This cannot be fixed by the program.
 
**Q: `A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.`**
**Q: Error `Channel was blocked by Cloudflare`**
A: Your network is unstable or being blocked by Chaturbate, the program can't help with the network issue. Usually happened when you are using VPN or Proxy.
> You've been temporarily blocked. See the [Cookies & User-Agent](#-cookies--user-agent) section to bypass.
 
**Q: `I'm receiving a message about CloudFlare anti-bot, what do I need to do?`**
A: You need to successfully pass the CloudFlare anti-bot check and retrieve the cf_clearance Cookie that is set in the browser after successfully passing the check. This MUST be done from the same IP address and the same User-Agent string MUST be provided to chaturbate-dvr. Provide the cookie value and User-Agent string with the --cf-cookie and --user-agent command line options. The Cookie does expire, but it looks like it's Age is at ~1 year.
 
## 💬 Verbose Log
Change `-log-level` to `DEBUG` to see more details in terminal, like Duration and Size.
```yaml
# Availables: DEBUG, INFO, WARN, ERROR
$ chaturbate-dvr -u hepbugbear -log-level DEBUG
[2024-01-24 01:18:11] [INFO] [hepbugbear] segment #0 written
[2024-01-24 01:18:11] [DEBUG] [hepbugbear] duration: 00:00:06, size: 0.00 MiB
[2024-01-24 01:18:11] [INFO] [hepbugbear] segment #1 written
[2024-01-24 01:18:11] [DEBUG] [hepbugbear] duration: 00:00:06, size: 1.36 MiB
[2024-01-24 01:18:11] [INFO] [hepbugbear] segment #2 written
[2024-01-24 01:18:11] [DEBUG] [hepbugbear] duration: 00:00:06, size: 2.72 MiB
[2024-01-24 01:18:12] [DEBUG] [hepbugbear] segment #3 fetched
[2024-01-24 01:18:13] [INFO] [hepbugbear] segment #3 written
[2024-01-24 01:18:13] [DEBUG] [hepbugbear] duration: 00:00:10, size: 4.08 MiB
```