Skip to content

de/aniworld: Use hidden search endpoint for faster fetching#64

Merged
cuong-tran merged 6 commits intoyuzono:masterfrom
demenik:master
Mar 14, 2026
Merged

de/aniworld: Use hidden search endpoint for faster fetching#64
cuong-tran merged 6 commits intoyuzono:masterfrom
demenik:master

Conversation

@demenik
Copy link
Contributor

@demenik demenik commented Mar 8, 2026

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
  • Have made sure all the icons are in png format

This PR replaces the /ajax/search endpoint with /ajax/seriesSearch. This endpoint also returns the thumbnail_url in a low resolution, which gets edited to the "high" resolution URL.

I've also added a shell.nix and .envrc for NixOS-development.


Add a 👍 reaction to pull requests you find important.

Summary by Sourcery

Use AniWorld's hidden series search endpoint and improve development setup for Nix users.

New Features:

  • Add Nix shell configuration and direnv environment file for easier NixOS-based development.

Bug Fixes:

  • Stop performing an extra page fetch per search result by relying on the series search API's thumbnail data.

Enhancements:

  • Switch AniWorld search to the /ajax/seriesSearch endpoint and parse its richer JSON response, including direct cover URLs and descriptions.
  • Simplify search result handling by constructing anime entries directly from the API response instead of scraping individual series pages.
  • Update AniWorld extension version code to reflect the search behavior change.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 8, 2026

Reviewer's Guide

Updates the AniWorld extension to use the faster /ajax/seriesSearch GET endpoint with direct JSON parsing for search results, including thumbnails, removes the old POST-based search flow, bumps the extension version, and adds Nix-based development environment files.

Sequence diagram for the updated AniWorld search flow

sequenceDiagram
    actor User
    participant TachiyomiApp
    participant AniWorld
    participant AniWorldServer

    User->>TachiyomiApp: Enter search query
    TachiyomiApp->>AniWorld: searchAnimeRequest(page, query, filters)
    AniWorld->>AniWorld: Build headers with Referer and XMLHTTPRequest headers
    AniWorld->>AniWorldServer: GET /ajax/seriesSearch?keyword=encoded_query
    AniWorldServer-->>AniWorld: JSON array of results (name, link, cover, description)
    TachiyomiApp->>AniWorld: searchAnimeParse(response)
    AniWorld->>AniWorld: Decode JSON array using Json
    AniWorld->>AniWorld: Map entries to SAnime with title, url, thumbnail_url, description
    AniWorld-->>TachiyomiApp: AnimesPage(animes, hasNextPage=false)
    TachiyomiApp-->>User: Display search results with thumbnails
Loading

Updated class diagram for the AniWorld search implementation

classDiagram
    class ParsedAnimeHttpSource {
    }

    class AniWorld {
        +searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request
        +searchAnimeSelector(): String
        +searchAnimeParse(response: Response): AnimesPage
        +searchAnimeFromElement(element: Element): SAnime
    }

    ParsedAnimeHttpSource <|-- AniWorld
Loading

File-Level Changes

Change Details Files
Switch search implementation to the hidden /ajax/seriesSearch endpoint and construct SAnime directly from JSON without follow-up HTML fetches.
  • Replace POST /ajax/search with GET /ajax/seriesSearch using URL-encoded keyword query parameter and adjusted headers.
  • Parse the JSON array response by reading name, link, cover, and description fields and mapping them into SAnime instances.
  • Build anime URLs as /anime/stream/ and derive high-resolution thumbnail URLs by replacing 150x225 with 220x330 and prefixing with baseUrl.
  • Remove the previous animeFromSearch helper that fetched each anime page to scrape the thumbnail and drop unused imports (JsonObject, POST, FormBody).
  • Keep searchAnimeSelector and searchAnimeFromElement as unsupported since search is fully JSON-based.
src/de/aniworld/src/eu/kanade/tachiyomi/animeextension/de/aniworld/AniWorld.kt
Bump the AniWorld extension version to reflect the search implementation changes.
  • Increment extVersionCode from 31 to 32.
src/de/aniworld/build.gradle
Add Nix and direnv configuration to ease development on NixOS.
  • Introduce shell.nix defining an Android-capable development shell with Gradle 9, JDK 17, and Android SDK packages plus environment variables and Gradle options.
  • Add a minimal .envrc file to load the Nix shell via direnv.
shell.nix
.envrc

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the AniWorld extension by optimizing its search mechanism for improved performance and accuracy. It also introduces NixOS development environment configurations, streamlining the setup process for developers using NixOS.

Highlights

  • AniWorld Search Endpoint: Switched the AniWorld extension's search functionality from the /ajax/search endpoint to the faster /ajax/seriesSearch endpoint.
  • Thumbnail Resolution: Implemented logic to correctly handle and adjust the resolution of thumbnail_url fetched from the new search endpoint.
  • NixOS Development Support: Added configuration files (shell.nix and .envrc) to support NixOS-based development environments.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .envrc
    • Added use nix directive for direnv integration.
  • .gitignore
    • Added .direnv/ to ignore direnv-related files.
  • shell.nix
    • Introduced a Nix shell configuration for Android development, including Gradle, JDK17, and Android SDK setup.
  • src/de/aniworld/build.gradle
    • Incremented the extVersionCode for the AniWorld extension from 31 to 32.
  • src/de/aniworld/src/eu/kanade/tachiyomi/animeextension/de/aniworld/AniWorld.kt
    • Removed unused POST, JsonObject, and FormBody imports, and added URLEncoder import.
    • Refactored searchAnimeRequest to use a GET request to the /ajax/seriesSearch endpoint, URL-encoding the search query and adjusting request headers.
    • Rewrote searchAnimeParse to directly process JSON array results into SAnime objects, extracting title, URL, description, and dynamically adjusting thumbnail URLs, while removing the animeFromSearch helper function.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@sourcery-ai sourcery-ai bot left a comment

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:

  • When encoding the search query, prefer using URLEncoder.encode(query, StandardCharsets.UTF_8.name()) (or a shared helper) rather than the hardcoded "UTF-8" string to avoid magic strings and potential encoding typos.
  • The newly added .envrc file is empty; consider either adding a minimal directive like use nix to integrate with shell.nix or removing the file to avoid confusion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- When encoding the search query, prefer using `URLEncoder.encode(query, StandardCharsets.UTF_8.name())` (or a shared helper) rather than the hardcoded "UTF-8" string to avoid magic strings and potential encoding typos.
- The newly added `.envrc` file is empty; consider either adding a minimal directive like `use nix` to integrate with `shell.nix` or removing the file to avoid confusion.

## Individual Comments

### Comment 1
<location path="shell.nix" line_range="11" />
<code_context>
+    },
+}: let
+  androidComposition = pkgs.androidenv.composeAndroidPackages {
+    buildToolsVersions = ["36.0.0"];
+    platformVersions = ["34"];
+    abiVersions = ["armeabi-v7a"];
</code_context>
<issue_to_address>
**issue (bug_risk):** The Android build tools version `36.0.0` may not exist in current SDKs and could break environment setup.

Using `36.0.0` assumes that build-tools 36 is already available in the SDK Nix fetches; if it isn’t, `androidenv.composeAndroidPackages` will fail to resolve the toolchain. Consider pinning this to a currently published version (e.g., `35.0.0` or your actual target) and only bumping once 36.0.0 is confirmed available.
</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.

Copy link
Contributor

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

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 significantly improves the search functionality for the AniWorld extension by switching to a more efficient API endpoint. This change eliminates extra network requests, leading to faster search results. The implementation of the new parsing logic is well-done and a great improvement. The addition of Nix development files is also a welcome enhancement for developers using NixOS. I have one suggestion to make the URL construction more robust.

…tion

* Use `HttpUrl` builder for search queries to handle encoding correctly.
* Migrate thumbnail URL generation to use `UrlUtils.fixUrl`.
* Remove unused `URLEncoder` import.
@cuong-tran cuong-tran merged commit 2b410c6 into yuzono:master Mar 14, 2026
4 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants