|
9 | 9 | [--original-name][--original-metadata][--no-original][--only-original] |
10 | 10 | [--name-format <format>][--strict-playlist][--playlist-name-format <format>] |
11 | 11 | [--client-id <id>][--auth-token <token>][--overwrite][--no-playlist][--opus] |
12 | | - [--add-description][--yt-dlp-args <argstring>] |
| 12 | + [--add-description][--impersonate <target>][--yt-dlp-args <argstring>] |
13 | 13 |
|
14 | 14 | scdl -h | --help |
15 | 15 | scdl --version |
|
69 | 69 | --no-playlist Skip downloading playlists |
70 | 70 | --add-description Adds the description to a separate txt file |
71 | 71 | --opus Prefer downloading opus streams over mp3 streams |
| 72 | + --impersonate [target] Forward yt-dlp's --impersonate (requires curl_cffi) |
72 | 73 | --yt-dlp-args [argstring] String with custom args to forward to yt-dlp |
73 | 74 | """ |
74 | 75 |
|
@@ -155,6 +156,7 @@ class SCDLArgs(TypedDict): |
155 | 156 | sync: str | None |
156 | 157 | s: str | None |
157 | 158 | t: bool |
| 159 | + impersonate: str | None |
158 | 160 | yt_dlp_args: str |
159 | 161 |
|
160 | 162 |
|
@@ -395,7 +397,7 @@ def _build_ytdl_params(url: str, scdl_args: SCDLArgs) -> tuple[str, dict, list]: |
395 | 397 | elif scdl_args.get("p"): |
396 | 398 | url = posixpath.join(url, "sets") |
397 | 399 | elif scdl_args.get("r"): |
398 | | - url = posixpath.join(url, "reposts") |
| 400 | + url = ensure_suffix(base, "reposts") |
399 | 401 |
|
400 | 402 | params: dict = {} |
401 | 403 |
|
@@ -502,6 +504,11 @@ def _build_ytdl_params(url: str, scdl_args: SCDLArgs) -> tuple[str, dict, list]: |
502 | 504 | if scdl_args.get("opus"): |
503 | 505 | params["--extractor-args"] = "soundcloud:formats=*_aac,*_opus,*_mp3" |
504 | 506 |
|
| 507 | + if scdl_args.get("impersonate"): |
| 508 | + params["--impersonate"] = scdl_args.get("impersonate") |
| 509 | + elif scdl_args.get("t"): |
| 510 | + params["--impersonate"] = "chrome" |
| 511 | + |
505 | 512 | argv = [] |
506 | 513 | for param, value in params.items(): |
507 | 514 | if value is False: |
|
0 commit comments