Skip to content

Enhance Rootz API integration with page token and download improvements#199

Merged
Stivenjs merged 1 commit into
mainfrom
console-mode
May 21, 2026
Merged

Enhance Rootz API integration with page token and download improvements#199
Stivenjs merged 1 commit into
mainfrom
console-mode

Conversation

@Stivenjs
Copy link
Copy Markdown
Owner

This pull request significantly refactors and improves the handling of Rootz.so download resolution, making it more robust and browser-like, and adds better error handling and metadata support. The main focus is on reliably resolving signed CDN URLs from Rootz.so, handling page tokens, and providing clearer error messages for users. There are also some minor cleanups and exports.

Rootz.so Download Handling Improvements:

  • Refactored the Rootz.so resolver to mimic browser behavior: it now fetches the pageToken from the download page, uses the proper API endpoints, and follows redirects to obtain a signed CDN URL (e.g., R2/Cloudflare Storage). This includes retry logic and fallback strategies for improved reliability. [1] [2]
  • Enhanced error messages and metadata extraction: now provides file name hints and clearer, context-aware messages for cases such as password protection, deleted files, or exhausted download limits.
  • The resolver now returns an optional file name hint along with the URL and referer, improving downstream UX. [1] [2]

Network Layer and Profile Preset Updates:

  • The ProfilePreset::RootzApi variant now requires a page_token and referer, and these are used to set the appropriate headers for Rootz API requests, including the custom X-Page-Token header. [1] [2]
  • Added a new head_with_client function to the network layer, which performs HEAD requests with a shared client and follows redirects—crucial for resolving CDN URLs. [1] [2]

General Codebase Cleanups:

  • Minor documentation and comment improvements for clarity, especially around HTTP download behavior and error messages. [1] [2]
  • Moved the matcher module import for consistency.

Hoster Resolution Logic:

These changes make Rootz.so downloads more reliable and user-friendly, and lay the groundwork for future hoster improvements.- Updated the RootzApi profile preset to include page token and referer fields for improved download handling.

  • Introduced a new head_with_client function to manage HTTP HEAD requests with session cookies and redirection.
  • Enhanced the download resolution process to handle signed CDN URLs and provide better error messages for various states.
  • Refactored the Rootz API interaction to extract and utilize page tokens for more reliable download links.

- Updated the RootzApi profile preset to include page token and referer fields for improved download handling.
- Introduced a new `head_with_client` function to manage HTTP HEAD requests with session cookies and redirection.
- Enhanced the download resolution process to handle signed CDN URLs and provide better error messages for various states.
- Refactored the Rootz API interaction to extract and utilize page tokens for more reliable download links.
@Stivenjs Stivenjs self-assigned this May 21, 2026
@Stivenjs Stivenjs added enhancement New feature or request good first issue Good for newcomers wontfix This will not be worked on labels May 21, 2026
@Stivenjs Stivenjs merged commit 783054e into main May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request good first issue Good for newcomers wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant