diff --git a/.gitignore b/.gitignore index 3c57308..eeda355 100644 --- a/.gitignore +++ b/.gitignore @@ -222,3 +222,4 @@ dev_test/ widevine/ info.md /downloads +.env.bak diff --git a/README.fr.md b/README.fr.md index 208dca4..82588ef 100644 --- a/README.fr.md +++ b/README.fr.md @@ -90,6 +90,8 @@ options: Répertoire de sortie pour les fichiers téléchargés (par défaut: ./downloads) --widevine-device WIDEVINE_DEVICE Chemin vers le CDM Widevine (par défaut: ./widevine/device.wvd) + --batch-size BATCH_SIZE + Nombre de requêtes pour le bruteforce (par défaut: 20000) --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL} Définir le niveau de logging (par défaut: INFO) ``` @@ -100,7 +102,7 @@ https://github.com/user-attachments/assets/cc76990a-3d13-4be1-bb3c-ba8d87e6eaba **Télécharger un programme spécifique avec une durée :** ```bash -uv run main.py --channel-id 536 --start-date "2025-12-19 12:00:00" --duration "01:30:00" --video "1080p+best" --audio "best" --title "MonFilm" +uv run main.py --channel-id 536 --start-date "2025-12-19 12:00:00" --duration "01:30:00" --video "1080p+best" --audio "best" --title "Enregistrement" ``` **Télécharger avec des clés DRM manuelles :** diff --git a/README.md b/README.md index 42cfcac..3d02334 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ options: Output directory for downloaded files (default: ./downloads) --widevine-device WIDEVINE_DEVICE Path to Widevine device file (default: ./widevine/device.wvd) + --batch-size BATCH_SIZE + Batch size for bruteforce (default: 20000) --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL} Set the logging level (default: INFO) ``` @@ -100,7 +102,7 @@ https://github.com/user-attachments/assets/cc76990a-3d13-4be1-bb3c-ba8d87e6eaba **Download a specific program with duration:** ```bash -uv run main.py --channel-id 536 --start-date "2025-12-19 12:00:00" --duration "01:30:00" --video "1080p+best" --audio "best" --title "MyMovie" +uv run main.py --channel-id 536 --start-date "2025-12-19 12:00:00" --duration "01:30:00" --video "1080p+best" --audio "best" --title "Record" ``` **Download with manual DRM keys:** diff --git a/main.py b/main.py index 5ed64c0..512982d 100644 --- a/main.py +++ b/main.py @@ -85,6 +85,12 @@ def parse_arguments(): default="./widevine/device.wvd", help="Path to Widevine device file (default: ./widevine/device.wvd)", ) + parser.add_argument( + "--batch-size", + type=int, + default=20000, + help="Batch size for bruteforce (default: 20000)", + ) parser.add_argument( "--log-level", type=str, @@ -182,6 +188,7 @@ if __name__ == "__main__": logger.debug("DRM keys: %s", keys) logger.debug("Output dir: %s", args.output_dir) logger.debug("Widevine device: %s", args.widevine_device) + logger.debug("Batch size: %d", args.batch_size) else: # Interactive mode @@ -206,6 +213,7 @@ if __name__ == "__main__": title = title or f"{freebox_id}_{start_date.strftime('%Y%m%d_%H%M%S')}" keys = [] + batch_size = args.batch_size if cli_mode else 20000 output_dir = os.getenv("OUTPUT_DIR") or ( args.output_dir if cli_mode else "./downloads" ) @@ -244,7 +252,7 @@ if __name__ == "__main__": "Date mismatch between requested start date and manifest data, bruteforce method is needed." ) - valid_ticks = asyncio.run(bruteforce(track_id, start_tick_user)) + valid_ticks = asyncio.run(bruteforce(track_id, start_tick_user, batch_size)) valid_tick = valid_ticks[0] start_tick, start_rep = find_nearest_tick_by_hour( diff --git a/utils/times.py b/utils/times.py index a70cdf0..4d410c6 100644 --- a/utils/times.py +++ b/utils/times.py @@ -51,11 +51,10 @@ def future(rep, base, duration): return base + rep * duration -async def bruteforce(track_id, date): +async def bruteforce(track_id, date, batch_size=20000): """Bruteforce segments to find valid ticks.""" valid_ticks = [] total_requests = 288000 - batch_size = 20000 logger.debug("Starting bruteforce for %s near %s", track_id, date)