yt-dlp-dags/policies/5_ban_test_policies.yaml

85 lines
3.3 KiB
YAML

# This file contains policies for testing ban rates and profile survival
# under high request counts.
---
# Policy: Single Profile Ban Test (500 Requests)
# This policy uses a single worker and a single, non-rotating profile to make
# 500 consecutive info.json requests. It is designed to test if and when a
# single profile/visitor_id gets banned or rate-limited by YouTube.
#
# It explicitly disables the server's automatic visitor ID rotation to ensure
# the same identity is used for all requests.
#
# The test will stop if it encounters 3 errors within any 1-minute window,
# or a total of 8 errors within any 60-minute window.
name: single_profile_ban_test_500
settings:
mode: fetch_only
urls_file: "urls.txt" # Override with --set settings.urls_file=...
info_json_script: "bin/ytops-client get-info"
save_info_json_dir: "fetched_info_jsons/ban_test_single_profile"
# Use one worker with one profile that does not rotate automatically.
profile_mode: per_worker_with_rotation
profile_management:
prefix: "ban_test_user"
# Set a high request limit to prevent the orchestrator from rotating the profile.
max_requests_per_profile: 1000
execution_control:
run_until: { requests: 500 } # Stop after 500 total requests.
workers: 1
sleep_between_tasks: { min_seconds: 1, max_seconds: 2 }
info_json_generation_policy:
client: "tv_simply" # A typical client for this kind of test.
# Explicitly disable the server's visitor ID rotation mechanism.
request_params:
session_params:
visitor_rotation_threshold: 0
stop_conditions:
# Stop if we get 3 or more errors in any 1-minute window (rapid failure).
on_error_rate: { max_errors: 3, per_minutes: 1 }
# Stop if we get 8 or more 403 errors in any 60-minute window (ban detection).
on_cumulative_403: { max_errors: 8, per_minutes: 60 }
---
# Policy: Multi-Profile Survival Test
# This policy uses 5 parallel workers, each with its own unique profile.
# It tests whether using multiple profiles with the server's default automatic
# visitor ID rotation (every 250 requests) can sustain a high request rate
# without getting banned.
#
# The test will run until 1250 total requests have been made (250 per worker),
# which should trigger one rotation for each profile.
name: multi_profile_survival_test
settings:
mode: fetch_only
urls_file: "urls.txt" # Override with --set settings.urls_file=...
info_json_script: "bin/ytops-client get-info"
save_info_json_dir: "fetched_info_jsons/ban_test_multi_profile"
# Use 5 workers, each getting its own rotating profile.
profile_mode: per_worker_with_rotation
profile_management:
prefix: "survival_test_user"
# Use the default rotation threshold of 250 requests per profile.
max_requests_per_profile: 250
execution_control:
run_until: { requests: 1250 } # 5 workers * 250 requests/rotation = 1250 total.
workers: 5
sleep_between_tasks: { min_seconds: 1, max_seconds: 2 }
info_json_generation_policy:
client: "tv_simply"
# No request_params are needed here; we want to use the server's default
# visitor ID rotation behavior.
stop_conditions:
# Stop if we get 3 or more errors in any 1-minute window (rapid failure).
on_error_rate: { max_errors: 3, per_minutes: 1 }
# Stop if we get 8 or more 403 errors in any 60-minute window (ban detection).
on_cumulative_403: { max_errors: 8, per_minutes: 60 }