Skip to content

AnimeVerse [EN]: Extension Overhaul#584

Draft
Alpha-782 wants to merge 4 commits into
yuzono:masterfrom
Alpha-782:verse-improvements
Draft

AnimeVerse [EN]: Extension Overhaul#584
Alpha-782 wants to merge 4 commits into
yuzono:masterfrom
Alpha-782:verse-improvements

Conversation

@Alpha-782

@Alpha-782 Alpha-782 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Checklist:

  • Updated extVersionCode value in build.gradle for individual extensions
  • Updated overrideVersionCode or baseVersionCode as needed for all multisrc extensions
  • Referenced all related issues in the PR body (e.g. "Closes #xyz")
  • Added the isNsfw = true flag in build.gradle when appropriate
  • Have not changed source names
  • Have explicitly kept the id if a source's name or language were changed
  • Have tested the modifications by compiling and running the extension through Android Studio
  • Have removed web_hi_res_512.png when adding a new extension
  • This PR is AI-assisted, I have reviewed the changes manually and confirmed they are not slop
  • Have made sure all the icons are in png format

Add a 👍 reaction to pull requests you find important.

Summary by Sourcery

Refactor the AnimeVerse extension to use shared auth and utility helpers, add catalog-based caching and richer search/filter capabilities, and simplify supported streaming servers while bumping the extension version.

New Features:

  • Introduce disk-backed caching for catalog and schedule data to reduce repeated network calls.
  • Add advanced search and filter options including genres, studios, year, season, rating label, and schedule-day-aware filtering.
  • Enrich popular and latest anime lists by merging schedule and catalog metadata for better titles and details.

Bug Fixes:

  • Fix auth handling by centralizing session and request signing logic and improving error handling and reuse.
  • Improve anime details resolution by correlating API responses with catalog entries via both ID and slug when available.

Enhancements:

  • Extract authentication, JSON mapping, and video extractor logic into separate helper files to improve maintainability and reuse.
  • Refine search implementation to work off cached catalog data with client-side filtering and rating-based sorting when no query is provided.
  • Generate filter options dynamically from cached catalog metadata with sensible ordering for seasons and rating labels.
  • Simplify supported streaming sources by removing unused hosts and treating only valid direct HTTP(S) streams as standard videos.

Build:

  • Bump the AnimeVerse extension version code from 3 to 4.

@sourcery-ai

sourcery-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Refactors AnimeVerse’s auth, utilities, catalog/search logic, and streaming extractors into separate helpers, adds disk-based catalog/schedule caching and richer search filters, simplifies video host handling to AnimeVerse + MegaPlay only, and bumps the extension version.

Sequence diagram for AnimeVerse auth interceptor flow

sequenceDiagram
    participant Client
    participant OkHttpClient
    participant AnimeVerseAuth
    participant AnimeVerseAPI

    Client->>OkHttpClient: newCall(request)
    OkHttpClient->>AnimeVerseAuth: authInterceptor(chain, networkClient, fingerprint)
    AnimeVerseAuth->>AnimeVerseAuth: sign(request, networkClient, fingerprint)
    AnimeVerseAuth->>AnimeVerseAuth: getAuth(networkClient, fingerprint)
    alt [no valid authKey]
        AnimeVerseAuth->>AnimeVerseAPI: POST /api/v1/session
        AnimeVerseAPI-->>AnimeVerseAuth: session response (clientAuthKey, av_session)
        AnimeVerseAuth->>AnimeVerseAuth: update authKey, authExpires, sessionCookie
    end
    AnimeVerseAuth-->>OkHttpClient: signed Request
    OkHttpClient->>AnimeVerseAPI: proceed(signed Request)
    AnimeVerseAPI-->>OkHttpClient: Response
    alt [Response.code == 401]
        OkHttpClient->>AnimeVerseAuth: invalidateAuth()
        OkHttpClient->>AnimeVerseAuth: sign(original Request, networkClient, fingerprint)
        AnimeVerseAuth-->>OkHttpClient: re-signed Request
        OkHttpClient->>AnimeVerseAPI: proceed(re-signed Request)
        AnimeVerseAPI-->>OkHttpClient: Response
    end
    OkHttpClient-->>Client: Response
Loading

File-Level Changes

Change Details Files
Refactor authentication and shared helpers into dedicated utility files and update the HTTP client to use them.
  • Move HMAC auth/session handling into AnimeVerseAuth.kt with shared state and interceptor functions
  • Extract SAnime mappers, JSON helpers, base64/image helpers, and generic utilities into AnimeVerseUtils.kt
  • Update AnimeVerse.kt to remove inline auth/utils code and call authInterceptor and shared helper functions instead
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerse.kt
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerseAuth.kt
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerseUtils.kt
Introduce disk-backed catalog and schedule caching and use it across popular, latest, search, filters, and details flows.
  • Replace in-memory catalog cache with a 24h cache persisted under cacheDir/source_/catalog.json
  • Add schedule caching per day in cacheDir/source_/schedule_.json with same TTL and shared lock
  • Update popular, latest, search, and filter-building logic to read from the cached catalog/schedule when available and gracefully fall back to network
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerse.kt
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerseUtils.kt
Rework search to operate on cached catalog/schedule data with advanced filters and suspend-based entrypoint.
  • Replace searchAnimeRequest/searchAnimeParse with a suspend getSearchAnime implementation that filters the catalog or schedule in-memory
  • Add genre (tri-state with OR/AND mode), studio, year, season, and rating-label filters, including helper sort methods and dynamic population from cached catalog
  • Keep schedule-day search but now correlate schedule entries with catalog items to enrich titles/genres and apply search filters
  • Mark old searchAnimeRequest/searchAnimeParse as unsupported via UnsupportedOperationException
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerse.kt
Adjust anime details and list parsing to better merge API data with catalog metadata and respect the alternate-title preference.
  • Cache the user preference for alt titles and pass it into jsonToAnime to avoid repeated preference lookups
  • On anime details, prefer catalog title/altTitle/genres/studios when available and fall back to anime API, matching by id when possible
  • Normalize joinToString usage (no explicit separators) and reuse shared JSON helper methods for fields like rating, genres, studios
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerse.kt
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerseUtils.kt
Simplify video extraction to AnimeVerse API and MegaPlay-only support, dropping Vidnest/Choi-specific logic and extracting MegaPlay handling.
  • Remove Vidnest/Choi-specific resolution paths, proxies, and base64 /r/ redirect handling, and only treat explicit http/https paths as direct streams
  • Limit SERVERS to animeverse and chiki, and map display names accordingly
  • Extract MegaPlay helpers into AnimeVerseExtractors.kt and update episode video fetching to use extractMegaplayId/fetchMegaplayVideos with shared PlaylistUtils
  • Preserve host exclusion preferences and refactor headers/response handling to use use blocks for proper closing
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerse.kt
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerseExtractors.kt
Miscellaneous cleanup and version bump for the AnimeVerse extension.
  • Switch from getPreferencesLazy to getPreferences and add applicationContext usage for cache file paths
  • Tighten imports by removing unused JSON/Android/OKHttp symbols and centralizing shared helpers in new files
  • Bump extVersionCode from 3 to 4 in build.gradle to ship the overhaul
src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerse.kt
src/en/animeverse/build.gradle

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Alpha-782 Alpha-782 self-assigned this Jul 3, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • There are now multiple Json instances and JSON helper extensions declared across AnimeVerse.kt, AnimeVerseAuth.kt, AnimeVerseExtractors.kt, and AnimeVerseUtils.kt; consider centralizing these into a single shared utility to avoid configuration drift and duplication.
  • The new getSearchAnime implementation mixes query parsing, filter evaluation, schedule handling, and catalog matching in a single method; splitting this into smaller helpers (e.g., for building predicates, applying filters, and mapping to SAnime) would make the logic easier to read and maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- There are now multiple `Json` instances and JSON helper extensions declared across `AnimeVerse.kt`, `AnimeVerseAuth.kt`, `AnimeVerseExtractors.kt`, and `AnimeVerseUtils.kt`; consider centralizing these into a single shared utility to avoid configuration drift and duplication.
- The new `getSearchAnime` implementation mixes query parsing, filter evaluation, schedule handling, and catalog matching in a single method; splitting this into smaller helpers (e.g., for building predicates, applying filters, and mapping to `SAnime`) would make the logic easier to read and maintain.

## Individual Comments

### Comment 1
<location path="src/en/animeverse/src/eu/kanade/tachiyomi/animeextension/en/animeverse/AnimeVerseAuth.kt" line_range="36-38" />
<code_context>
-
-        val body = """{"fp":$fingerprint}""".toJsonBody()
-
-        val sessionReq = Request.Builder()
-            .url("$baseUrl/api/v1/session")
-            .post(body)
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Avoid hardcoding the base URL in auth to keep it consistent with the source baseUrl

Hardcoding `https://animeverse.to/api/v1/session` means auth won’t follow any future changes to `baseUrl` (mirrors, regional domains, config overrides), while other requests will. Please derive the auth URL from `baseUrl` (or a shared constant), e.g. `"$baseUrl/api/v1/session"`, so it stays consistent.

```suggestion
    val sessionReq = Request.Builder()
        .url("$baseUrl/api/v1/session")
        .post(body)
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the AnimeVerse extension by extracting authentication, video extraction, and utility functions into separate files, implementing a disk-based caching mechanism for catalogs and schedules, and adding advanced search filters. The review feedback focuses on critical resource safety and performance optimizations, such as wrapping network responses in .use blocks to prevent connection leaks, caching file modification times in memory to avoid redundant disk I/O, and avoiding unnecessary file reads. Additionally, the reviewer recommends decoupling the codebase from hardcoded domains by passing baseUrl dynamically to utility and authentication functions, and correcting method calls to match updated signatures.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Alpha-782

Copy link
Copy Markdown
Collaborator Author
image

@Alpha-782 Alpha-782 marked this pull request as draft July 3, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant