de/aniworld: Use hidden search endpoint for faster fetching#64
de/aniworld: Use hidden search endpoint for faster fetching#64cuong-tran merged 6 commits intoyuzono:masterfrom
Conversation
Reviewer's GuideUpdates 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 flowsequenceDiagram
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
Updated class diagram for the AniWorld search implementationclassDiagram
class ParsedAnimeHttpSource {
}
class AniWorld {
+searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request
+searchAnimeSelector(): String
+searchAnimeParse(response: Response): AnimesPage
+searchAnimeFromElement(element: Element): SAnime
}
ParsedAnimeHttpSource <|-- AniWorld
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary of ChangesHello, 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
🧠 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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
.envrcfile is empty; consider either adding a minimal directive likeuse nixto integrate withshell.nixor 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
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.
src/de/aniworld/src/eu/kanade/tachiyomi/animeextension/de/aniworld/AniWorld.kt
Outdated
Show resolved
Hide resolved
This reverts commit 2e0d8b4.
…tion * Use `HttpUrl` builder for search queries to handle encoding correctly. * Migrate thumbnail URL generation to use `UrlUtils.fixUrl`. * Remove unused `URLEncoder` import.
Checklist:
extVersionCodevalue inbuild.gradlefor individual extensionsoverrideVersionCodeorbaseVersionCodeas needed for all multisrc extensionsisNsfw = trueflag inbuild.gradlewhen appropriateidif a source's name or language were changedweb_hi_res_512.pngwhen adding a new extensionThis PR replaces the
/ajax/searchendpoint with/ajax/seriesSearch. This endpoint also returns thethumbnail_urlin a low resolution, which gets edited to the "high" resolution URL.I've also added a
shell.nixand.envrcfor 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:
Bug Fixes:
Enhancements: