Kuramanime [id]: Fix extractor & Add filters#657
Open
bubz727 wants to merge 2 commits into
Open
Conversation
Contributor
Reviewer's GuideUpdates the Kuramanime extension to the new v19 site structure, fixes and hardens the multi-host video extraction flow (including Kuramadrive and new Doodstream support), and adds a richer search experience with order, status, type, and genre filters, while bumping the extension version and wiring in the new extractor dependency. Sequence diagram for Kuramanime searchAnimeRequest with new filterssequenceDiagram
actor User
participant Kuramanime
participant AnimeFilterList
participant StatusFilter
participant TypeFilter
participant GenreFilter
participant TachiyomiNetwork
User->>Kuramanime: searchAnimeRequest(page, query, filters)
alt query not empty
Kuramanime->>TachiyomiNetwork: GET("$baseUrl/anime", headers)
else query empty
Kuramanime->>AnimeFilterList: iterate filters
Kuramanime->>StatusFilter: toUriPart()
Kuramanime->>TypeFilter: toUriPart()
Kuramanime->>TypeFilter: toNamePart()
Kuramanime->>GenreFilter: toUriPart()
Kuramanime->>TachiyomiNetwork: GET(filteredUrl, headers)
end
Sequence diagram for updated Kuramanime videoListParse and doodstream extractionsequenceDiagram
participant Kuramanime
participant OkHttpClient
participant DoodExtractor
participant StreamWishExtractor
participant FilemoonExtractor
participant VidGuardExtractor
Kuramanime->>Kuramanime: videoListParse(response)
Kuramanime->>Kuramanime: getScriptData(bodyStr, doc)
Kuramanime->>OkHttpClient: newCall(POST(episodeUrl, playerHeaders, FormBody))
OkHttpClient-->>Kuramanime: playerDoc
Kuramanime->>Kuramanime: select("iframe") src
alt server == "doodstream"
Kuramanime->>DoodExtractor: videosFromUrl(url)
else server == "filelions"
Kuramanime->>StreamWishExtractor: videosFromUrl(url)
else server == "filemoon"
Kuramanime->>FilemoonExtractor: videosFromUrl(url)
else server == "streamwish" or "streamtape" or "vidguard"
Kuramanime->>StreamWishExtractor: videosFromUrl(url)
Kuramanime->>StreamTapeExtractor: videosFromUrl(url)
Kuramanime->>VidGuardExtractor: videosFromUrl(url)
else server == "kuramadrive" and originalKuramadriveSources not empty
Kuramanime->>Kuramanime: return originalKuramadriveSources
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- Consider caching the
ScriptDataDtoresult (e.g., in a lazy property) sogetScriptDatadoesn’t re-fetchsizzlyb.js/varJsfor everyvideoListParsecall, which will reduce repeated network overhead per episode. - The filter-handling logic in
searchAnimeRequestrelies on multiple mutable variables and awhenchain; you might simplify this by extracting the path-resolution and query-building into small helper functions to make the control flow easier to follow and maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider caching the `ScriptDataDto` result (e.g., in a lazy property) so `getScriptData` doesn’t re-fetch `sizzlyb.js`/`varJs` for every `videoListParse` call, which will reduce repeated network overhead per episode.
- The filter-handling logic in `searchAnimeRequest` relies on multiple mutable variables and a `when` chain; you might simplify this by extracting the path-resolution and query-building into small helper functions to make the control flow easier to follow and maintain.
## Individual Comments
### Comment 1
<location path="src/id/kuramanime/src/eu/kanade/tachiyomi/animeextension/id/kuramanime/Kuramanime.kt" line_range="248-250" />
<code_context>
+ return@parallelCatchingFlatMapBlocking originalKuramadriveSources
+ }
+
val newHeaders = headers.newBuilder()
.set("X-CSRF-TOKEN", csrfToken)
.set("X-Fuck-ID", scriptData.tokenId)
</code_context>
<issue_to_address>
**issue (bug_risk):** The newly built headers (including X-Fuck-ID) are never used when performing the request.
`newHeaders` is built with `X-CSRF-TOKEN`, `X-Fuck-ID`, and `X-Requested-With`, but the request still uses `playerHeaders`, which only includes `X-CSRF-TOKEN`. If the backend relies on `X-Fuck-ID`/`X-Requested-With`, relevant streams may fail. Please either use `newHeaders` for the POST or consolidate the header construction so all required headers are sent.
</issue_to_address>
### Comment 2
<location path="src/id/kuramanime/src/eu/kanade/tachiyomi/animeextension/id/kuramanime/Kuramanime.kt" line_range="321-330" />
<code_context>
+ private fun getScriptData(html: String, doc: Document): ScriptDataDto? {
</code_context>
<issue_to_address>
**issue (bug_risk):** getScriptData now performs multiple network calls without failure handling, which can break video parsing on transient errors.
The previous implementation used `runCatching` and returned `null` on failures so `videoListParse` could fall back to an empty list. The new version performs multiple HTTP requests (e.g., `sizzlyb.js`, attribute-based script) without handling exceptions, so any IO error may now propagate and break playback. Please reintroduce failure handling around the network calls (e.g., `runCatching` returning `null` or similar) to preserve the earlier, more resilient behavior.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
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 extensionAdd a 👍 reaction to pull requests you find important.
Summary by Sourcery
Update Kuramanime extension to work with the latest site changes and improve search and playback capabilities.
New Features:
Bug Fixes:
Enhancements:
Build: