fix(api): use browser cookies for library, as is done for search - #146
Open
Dragonjinx wants to merge 11 commits into
Open
Dragonjinx wants to merge 11 commits into
Dragonjinx wants to merge 11 commits into
Conversation
Dragonjinx
commented
Aug 28, 2026
- Fix: main library/homepage API now reads browser cookies via rookie
- Refactor: single-sourced the user-agent into ytpapi2::YT_USER_AGENT so all callers (fallback, search, API) share one value.
- Flake: added a flake.nix with packages.default, devShells.default, and apps.default.
- Main API reads cookies via rookie (--with-auto-cookies) instead of a stale headers.txt, mirroring the search popup's behaviour. Fixes InvalidHeaders on the library/homepage. - Add a nix flake with packages.default, devShells.default, apps.default.
Previously the Firefox UA was hardcoded inline in three places with two differing values (rv:108.0 fallback in ytpapi2, rv:128.0 in search + api). Single-source it into ytpapi2::YT_USER_AGENT so all callers share one value and bumping the UA updates everywhere.
When imported into a NixOS config via fixedPoints.fix (greyline pattern), the flake's `self` is the outputs attrs (apps/devShells/packages), not a source dir — so src=self passed the whole outputs set to buildRustPackage and failed to stringify. Use a path relative to the flake's own dir, matching greyline.
NixOS config overrides the flake's nixpkgs input anyway (injects host pkgs via fixedPoints.fix), so the flake's own pin only affects standalone nix flake/local builds. Point it at unstable for dev consistency.
Remove the prose src=./. explanation in the flake and the multi-line doc comment on YT_USER_AGENT; the code is self-explanatory and the short remaining comments capture the intentional choices.
homepage is metadata only and does not affect where code is fetched or built (src=./. governs that), so it's safe to attribute the original source on master.
Dragonjinx
marked this pull request as ready for review
September 3, 2026 20:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.