diff --git a/README.md b/README.md index 91b1346..902d1ca 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,10 @@ scdl -l https://soundcloud.com/pandadub/sets/the-lost-ship --sync archive.txt # Download your likes (with authentification token) scdl me -f + +# Use yt-dlp impersonation (requires curl_cffi) +scdl -l https://soundcloud.com/ihatemyselfbeats/t-1 --impersonate chrome +# See yt-dlp --list-impersonate-targets for a list of targets ``` ## Options: @@ -96,6 +100,7 @@ scdl me -f --add-description Adds the description to a seperate txt file (can be read by some players) --no-playlist Skip downloading playlists --opus Prefer downloading opus streams over mp3 streams +--impersonate [target] Forward yt-dlp's --impersonate (requires curl_cffi) --yt-dlp-args String with custom args to forward to yt-dlp ``` diff --git a/pyproject.toml b/pyproject.toml index d596020..ed23223 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ description = "Download Music from Souncloud" readme = "README.md" requires-python = ">=3.9.0" dependencies = [ + "curl_cffi>=0.14.0", "docopt-ng>=0.9.0", "mutagen>=1.47.0", "soundcloud-v2>=1.6.1", diff --git a/scdl/scdl.py b/scdl/scdl.py index 0cd280a..6a2101f 100644 --- a/scdl/scdl.py +++ b/scdl/scdl.py @@ -9,7 +9,7 @@ [--original-name][--original-metadata][--no-original][--only-original] [--name-format ][--strict-playlist][--playlist-name-format ] [--client-id ][--auth-token ][--overwrite][--no-playlist][--opus] - [--add-description][--yt-dlp-args ] + [--add-description][--impersonate ][--yt-dlp-args ] scdl -h | --help scdl --version @@ -69,6 +69,7 @@ --no-playlist Skip downloading playlists --add-description Adds the description to a separate txt file --opus Prefer downloading opus streams over mp3 streams + --impersonate [target] Forward yt-dlp's --impersonate (requires curl_cffi) --yt-dlp-args [argstring] String with custom args to forward to yt-dlp """ @@ -155,6 +156,7 @@ class SCDLArgs(TypedDict): sync: str | None s: str | None t: bool + impersonate: str | None yt_dlp_args: str @@ -502,6 +504,11 @@ def _build_ytdl_params(url: str, scdl_args: SCDLArgs) -> tuple[str, dict, list]: if scdl_args.get("opus"): params["--extractor-args"] = "soundcloud:formats=*_aac,*_opus,*_mp3" + if scdl_args.get("impersonate"): + params["--impersonate"] = scdl_args.get("impersonate") + elif scdl_args.get("t"): + params["--impersonate"] = "chrome" + argv = [] for param, value in params.items(): if value is False: