yt-dlp-dags/policies/3_full_stack_policies.yaml

159 lines
5.4 KiB
YAML

# This file contains policies for full-stack tests, which include both
# info.json generation and the subsequent download step.
---
# Policy: TV client with profile rotation.
# This test uses multiple parallel workers. Each worker gets its own profile
# that is automatically rotated (e.g., from tv_user_0_0 to tv_user_0_1) after
# a certain number of requests to simulate user churn.
name: tv_simply_profile_rotation
settings:
mode: full_stack
urls_file: "urls.txt"
info_json_script: "bin/ytops-client get-info"
save_info_json_dir: "fetched_info_jsons/tv_simply_rotation"
# Use the modern profile management system.
profile_mode: per_worker_with_rotation
profile_management:
prefix: "tv_simply"
# Rotate to a new profile generation after 250 requests.
max_requests_per_profile: 250
execution_control:
run_until: { cycles: 1 }
workers: 8 # Run with 8 parallel workers.
sleep_between_tasks: { min_seconds: 2, max_seconds: 5 }
# Optional: Override assumptions to improve rate estimation.
# assumptions:
# fetch_task_duration: 10 # Est. seconds to get info.json
# download_task_duration: 20 # Est. seconds to download all formats for one video
info_json_generation_policy:
client: tv_simply
download_policy:
formats: "18,140"
extra_args: "--cleanup --output-dir downloads/tv_simply_rotation"
proxy: "socks5://127.0.0.1:1087"
downloader: "aria2c"
downloader_args: "aria2c:-x 8 -k 1M"
sleep_between_formats: { min_seconds: 2, max_seconds: 2 }
stop_conditions:
on_cumulative_403: { max_errors: 5, per_minutes: 2 }
---
# Policy: TV Simply, full-stack test with per-worker profile rotation.
# Generates info.json using tv_simply and immediately attempts to download.
# This combines the fetch and download steps into a single workflow.
name: tv_simply_full_stack_rotation
settings:
mode: full_stack
urls_file: "urls.txt"
info_json_script: "bin/ytops-client get-info"
profile_mode: per_worker_with_rotation
profile_management:
prefix: "tv_simply_worker"
max_requests_per_profile: 240
execution_control:
workers: 10
run_until: { cycles: 1 }
sleep_between_tasks: { min_seconds: 5, max_seconds: 5 }
info_json_generation_policy:
client: "tv_simply"
request_params:
context_reuse_policy: { enabled: false }
download_policy:
formats: "18,140"
extra_args: "--output-dir downloads/tv_simply_downloads"
---
# Policy: MWeb client with multiple profiles, each with its own cookie file.
# This demonstrates how to run an authenticated test with a pool of accounts.
# The orchestrator will cycle through the cookie files, assigning one to each profile.
name: mweb_multi_profile_with_cookies
settings:
mode: full_stack
urls_file: "urls.txt"
info_json_script: "bin/ytops-client get-info"
# Use the dynamic profile pool management system.
profile_management:
prefix: "mweb_user"
initial_pool_size: 3 # Start with 3 profiles.
auto_expand_pool: true # Create new profiles if the initial 3 are all rate-limited.
max_requests_per_profile: 100 # Let each profile make 100 requests...
sleep_minutes_on_exhaustion: 15 # ...then put it to sleep for 15 minutes.
# Assign a different cookie file to each profile in the pool.
# The tool will cycle through this list.
cookie_files:
- "/path/to/your/mweb_cookies_0.txt"
- "/path/to/your/mweb_cookies_1.txt"
- "/path/to/your/mweb_cookies_2.txt"
execution_control:
run_until: { cycles: 1 }
workers: 3 # Match workers to the number of initial profiles.
sleep_between_tasks: { min_seconds: 1, max_seconds: 3 }
info_json_generation_policy:
client: mweb
# This client uses youtubei.js, which generates PO tokens.
download_policy:
formats: "18,140"
extra_args: "--cleanup --output-dir /tmp/downloads"
---
# Policy: TV client with profile rotation and aria2c RPC download.
# This test uses multiple parallel workers. Each worker gets its own profile
# that is automatically rotated. Downloads are submitted to an aria2c daemon
# via its RPC interface.
name: tv_simply_profile_rotation_aria2c_rpc
settings:
mode: full_stack
urls_file: "urls.txt"
info_json_script: "bin/ytops-client get-info"
save_info_json_dir: "fetched_info_jsons/tv_simply_rotation_aria"
profile_mode: per_worker_with_rotation
profile_management:
prefix: "tv_simply_aria"
max_requests_per_profile: 250
execution_control:
run_until: { cycles: 1 }
workers: 8
sleep_between_tasks: { min_seconds: 2, max_seconds: 5 }
info_json_generation_policy:
client: tv_simply
download_policy:
formats: "18,140"
# Use the aria2c RPC downloader
downloader: "aria2c_rpc"
# RPC server connection details
aria_host: "localhost"
aria_port: 6800
# aria_secret: "your_secret" # Uncomment and set if needed
# Set to true to wait for each download and get a success/fail result.
# This is the default and recommended for monitoring success/failure.
# Set to false for maximum submission throughput ("fire-and-forget"),
# but you will lose per-download status reporting.
aria_wait: true
# The output directory is on the aria2c host machine
output_dir: "/downloads/tv_simply_rotation_aria"
# Pass custom arguments to aria2c in yt-dlp format for better performance.
# -x: max connections per server, -k: min split size.
downloader_args: "aria2c:[-x 8, -k 1M]"
sleep_between_formats: { min_seconds: 1, max_seconds: 2 }
stop_conditions:
on_cumulative_403: { max_errors: 5, per_minutes: 2 }