yt-dlp-dags/policies/4_custom_scenarios.yaml

59 lines
2.4 KiB
YAML

# This file contains custom policies for specific testing scenarios.
---
# Policy: Fetch info.json with visitor ID rotation.
# This policy uses a single worker to fetch info.json files for a list of URLs.
# It simulates user churn by creating a new profile (and thus a new visitor_id and POT)
# every 250 requests. A short sleep is used between requests.
name: fetch_with_visitor_id_rotation
settings:
mode: fetch_only
urls_file: "urls.txt" # Placeholder, should be overridden with --set
info_json_script: "bin/ytops-client get-info"
save_info_json_dir: "fetched_info_jsons/visitor_id_rotation"
# Use the modern profile management system to rotate visitor_id.
profile_mode: per_worker_with_rotation
profile_management:
prefix: "visitor_rotator"
# Rotate to a new profile generation after 250 requests.
max_requests_per_profile: 250
execution_control:
run_until: { cycles: 1 } # Run through the URL list once.
workers: 1 # Run with a single worker thread.
# A short, fixed sleep between each info.json request.
sleep_between_tasks: { min_seconds: 0.75, max_seconds: 0.75 }
info_json_generation_policy:
# Use a standard client. The server will handle token generation.
client: web
---
# Policy: Test download specific DASH formats from a folder of info.jsons.
# This policy uses a single worker to test-download a list of video-only DASH
# formats from a directory of existing info.json files. It only downloads the
# first 10KB of each format and sleeps between each file.
name: download_dashy_formats_test
settings:
mode: download_only
# Directory of info.json files to process.
info_json_dir: "fetched_info_jsons/visitor_id_rotation" # Assumes output from the above policy
execution_control:
run_until: { cycles: 1 } # Run through the info.json directory once.
workers: 1 # Run with a single worker thread.
# A longer, randomized sleep between processing each info.json file.
sleep_between_tasks: { min_seconds: 5, max_seconds: 10 }
download_policy:
# A specific list of video-only DASH formats to test.
# The "-dashy" suffix is illustrative; the format IDs must exist in the info.json.
formats: "299-dashy/298-dashy/137-dashy/136-dashy/135-dashy/134-dashy/133-dashy"
# Use the native Python downloader for better performance and control.
downloader: "native-py"
# Pass extra arguments to yt-dlp to perform a "test" download (first 10KB).
extra_args: '--download-sections "*0-10240"'
output_dir: "downloads/dash_test"