Commit graph

517 commits

Author SHA1 Message Date
bda0fea193 deobfuscate: soft-fail sig_fn/nsig_fn extraction
When YouTube rotates player.js to a shape our six sig/nsig regex
patterns don't recognise (eg. c2f7551f, May 2026), the whole player
path used to die at extract_fns even for clients that don't need the
sig fn at all (iOS, Android, Tv all get pre-signed stream URLs).

Now sig_fn / nsig_fn extraction is best-effort. Only the signature
timestamp is required — every `needs_deobf` client needs sts in
the request payload, but the actual deobfuscation functions are only
consumed by map_url when a stream URL carries `&s=` or `&n=`.
On failure we log a warning and store an empty string; Deobfuscator
then skips the JS eval, and any deobfuscate_sig/deobfuscate_nsig
call will fail loudly with "sig fn unavailable" instead of crashing
the player.

Keeps the Tv fallback alive even when sig deobf regex breaks.
2026-05-24 11:53:12 -07:00
a6df2ff7f4 client: prefer iOS over Android in default order
Android-only path requires Google device attestation (po_token /
botguard signing). iOS path has neither attestation nor sig deobf
requirements, so it's the cleanest "just works" default. Keep
Android in the rotation only when botguard is wired.
2026-05-24 11:50:56 -07:00
765a90e808 client: skip player.js deobf for Android + prefer Android-first client order
YouTube's Android InnerTube path returns pre-signed stream URLs (no `s=`
cipher param, no `n=` throttling param) just like the iOS path. Mark
Android as deobf-exempt and put it first in the default player client
order so the typical playback path stops fetching player.js entirely.
Avoids the `could not extract sig fn name` failure on YouTube's newer
player.js shapes (eg. c2f7551f).

Desktop stays in the rotation behind botguard for completeness; it
will still try to deobf and may fail, but it's only consulted as a
fallback for botguard-signed sessions now.
2026-05-24 11:50:15 -07:00
ThetaDev
6035e6db4e
fix: parse channel subscriber/video count correctly 2025-06-18 15:35:47 +02:00
ThetaDev
e7e389a316
feat: add unavailable field for music tracks
fix: handling albums with unavailable tracks
2025-06-18 15:34:05 +02:00
ta3pks
71712e4eda remove unwrap trying to fetch visitor data (#60)
Co-authored-by: nikos efthias <nikos@mugsoft.io>
Reviewed-on: https://codeberg.org/ThetaDev/rustypipe/pulls/60
Co-authored-by: ta3pks <ta3pks@noreply.codeberg.org>
Co-committed-by: ta3pks <ta3pks@noreply.codeberg.org>
2025-06-17 13:29:52 +02:00
ThetaDev
f0477ea3a9
test: add sig deobf test case 2025-04-23 21:29:51 +02:00
ThetaDev
be6da5e7e3
feat: player: handle VPN ban and captcha required error messages 2025-04-23 21:21:23 +02:00
ThetaDev
d675987654
fix: deobfuscator: handle 1-char long global variables, find nsig fn (player 6450230e) 2025-04-23 17:22:22 +02:00
ThetaDev
af415ddf8f chore(deps): update rust crate rand to 0.9.0 2025-04-03 11:08:18 +00:00
ThetaDev
daf3d035be
fix: handle music artist not found 2025-03-31 18:11:14 +02:00
ThetaDev
187bf1c9a0
fix: switch client if no adaptive stream URLs were returned 2025-03-26 02:44:08 +01:00
ThetaDev
ea80717f69
fix: handle music playlist/album not found 2025-03-26 02:35:03 +01:00
ThetaDev
939a7aea61
fix: deobfuscator: handle global functions as well 2025-03-26 02:12:18 +01:00
ThetaDev
189ba81a42
fix: extractor: small simplification 2025-03-26 01:38:12 +01:00
ThetaDev
ac44e95a88
fix: extractor: global variable extraction fixed 2025-03-26 01:20:35 +01:00
ThetaDev
07db7b1166
fix: handle player returning no adaptive stream URLs 2025-03-24 01:28:07 +01:00
ThetaDev
4ce6746be5
fix: extract deobf data with global strings variable 2025-03-24 01:12:01 +01:00
ThetaDev
e8acbfbbcf
fix: A/B test 22: commandExecutorCommand for playlist continuations 2025-03-16 19:45:14 +01:00
ThetaDev
63a6f50a8b
fix: always skip failed clients 2025-03-16 16:51:43 +01:00
ThetaDev
8342caeb0f
fix: desktop client: generate PO token from user_syncid when authenticated 2025-03-16 01:56:29 +01:00
ThetaDev
c04b60604d
fix: simplify get_player_from_clients logic 2025-03-16 01:24:54 +01:00
ThetaDev
e7ef067f43
small doc fix 2025-02-26 19:40:10 +01:00
ThetaDev
f3057b4d63
chore: remove commented-out debug statements 2025-02-26 19:32:46 +01:00
ThetaDev
6737512f5f
fix: A/B test 21: music album recommendations 2025-02-26 15:21:47 +01:00
ThetaDev
544782f8de
feat: add original album track count, fix fetching albums with more than 200 tracks 2025-02-26 15:21:47 +01:00
ThetaDev
80a358ee54
Revert "refactor!: rename n_http_retries option to n_request_attempts to be less misleading"
This reverts commit b8cfe1b034.
2025-02-09 02:20:55 +01:00
ThetaDev
1d755b76bf
feat: add RustyPipe::version_botguard fn, detect rustypipe-botguard in current dir, add botguard version to report 2025-02-09 01:52:09 +01:00
ThetaDev
0c94267d03
fix: only use cached potokens with min. 10min lifetime 2025-02-07 22:01:59 +01:00
ThetaDev
65cb4244c6
feat!: add userdata feature for all personal data queries (playback history, subscriptions) 2025-02-07 13:21:12 +01:00
ThetaDev
5acbf0e456
fix: use localzone crate to get local tz 2025-02-07 04:13:44 +01:00
ThetaDev
34f8e9b551
fix: compile error on windows 2025-02-07 04:13:44 +01:00
ThetaDev
a5a7be5b4e
fix: correct timezone offset for parsed dates, add timezone_local option 2025-02-07 04:13:44 +01:00
ThetaDev
3a2370b97c
feat: add timezone query option 2025-02-07 04:13:43 +01:00
ThetaDev
ccb1178b95
fix iOS client doc 2025-02-07 04:13:39 +01:00
ThetaDev
8297bf0234
update visitor data cache docs 2025-02-06 14:14:22 +01:00
ThetaDev
8e35358c89
feat: log failed player fetch attempts with player_from_clients 2025-02-06 14:04:01 +01:00
ThetaDev
a0d850f8e0
fix: output full request body in reports, clean up get_player_po_token 2025-02-06 03:56:11 +01:00
ThetaDev
b8cfe1b034
refactor!: rename n_http_retries option to n_request_attempts to be less misleading
the option sets the total number of attempts, not the number of attempts after the first failure
2025-02-06 03:16:03 +01:00
ThetaDev
dfd03edfad
feat: rewrite request attempt system, retry with different visitor data 2025-02-06 03:12:54 +01:00
ThetaDev
8385b87c63
feat: check rustypipe-botguard-api version 2025-02-06 01:41:48 +01:00
ThetaDev
b72b501b6d
feat: add session po token cache 2025-02-06 00:48:37 +01:00
ThetaDev
29c854b20d
fix: allow player data to be fetched without botguard 2025-02-05 15:56:15 +01:00
ThetaDev
eed1e3da3a
revert user agent 2025-02-05 15:56:15 +01:00
ThetaDev
b90a252a5e
feat: add support for rustypipe-botguard to get PO tokens 2025-02-05 15:56:14 +01:00
ThetaDev
b12f4c5d82
feat: add visitor data cache, remove random visitor data
Apparently YouTube can detect randomly generated visitor data and
prevents both the iOS and TV player from being fetched
(Error: Sign in to confirm you’re not a bot). Therefore the visitor
data generation code was removed and replaced with a cache that randomly
chooses from a selection of real visitor data.
2025-02-05 15:56:14 +01:00
ThetaDev
50ab1f7a5d
fix: retry updating deobf data after a RustyPipe update 2025-02-05 11:55:05 +01:00
ThetaDev
eda16e3787
fix: extracting nsig fn when outside variable starts with $ 2025-02-05 10:15:52 +01:00
ThetaDev
15245c18b5
fix: include whole request body in report 2025-01-25 03:19:50 +01:00
ThetaDev
9c67f8f85b
fix: a/b test 20: music continuation item renderer 2025-01-25 03:18:19 +01:00