Update MonosChinos extension for redesign website#654
Open
FFSA47 wants to merge 8 commits into
Open
Conversation
Contributor
Reviewer's GuideUpdates the MonosChinos Tachiyomi anime extension to match the redesigned site HTML, primarily by adjusting selectors for popular/latest lists and anime details, improving image URL resolution, and bumping the extension version code. Sequence diagram for updated image URL resolution in getImageUrlsequenceDiagram
participant MonosChinos
participant Element_img
MonosChinos->>Element_img: getImageUrl()
loop [for each candidate in data-src, data-lazy-src, srcset, src]
alt [candidate is srcset]
MonosChinos->>Element_img: attr("abs:srcset")
MonosChinos->>MonosChinos: substringBefore(" ")
else [candidate is not srcset]
MonosChinos->>Element_img: attr("abs:candidate")
end
alt [url is not blank and does not contain anime.png]
MonosChinos-->>MonosChinos: select first valid url
MonosChinos-->>Element_img: return url
note over MonosChinos: break
end
end
MonosChinos-->>Element_img: return null if no valid url
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:
- In latestUpdatesParse, nextPage is now hardcoded to false; if the redesigned site still exposes pagination, consider updating the selector instead of disabling pagination to preserve navigation behavior.
- The isValidUrl helper appears to be unused after the getImageUrl rewrite; consider removing it or reusing its logic in getImageUrl to avoid dead code and keep URL validation consistent.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In latestUpdatesParse, nextPage is now hardcoded to false; if the redesigned site still exposes pagination, consider updating the selector instead of disabling pagination to preserve navigation behavior.
- The isValidUrl helper appears to be unused after the getImageUrl rewrite; consider removing it or reusing its logic in getImageUrl to avoid dead code and keep URL validation consistent.
## Individual Comments
### Comment 1
<location path="src/es/monoschinos/src/eu/kanade/tachiyomi/animeextension/es/monoschinos/MonosChinos.kt" line_range="349-351" />
<code_context>
- else -> null
+ private fun Element.getImageUrl(): String? {
+ val candidates = listOf("data-src", "data-lazy-src", "srcset", "src")
+ return candidates.mapNotNull { attr ->
+ when (attr) {
+ "srcset" -> attr("abs:srcset").substringBefore(" ")
+ else -> attr("abs:$attr")
+ }
</code_context>
<issue_to_address>
**issue (bug_risk):** The lambda parameter name `attr` shadows the `Element.attr` function, which will cause this code not to compile.
Within `mapNotNull { attr -> ... }`, calls like `attr("abs:srcset")` resolve to the `String` lambda parameter rather than `Element.attr`, causing a compilation error. Rename the lambda parameter (e.g. to `name`) and call `attr("abs:srcset")` on the `Element` instead (e.g. `this.attr("abs:srcset")`).
</issue_to_address>
### Comment 2
<location path="src/es/monoschinos/src/eu/kanade/tachiyomi/animeextension/es/monoschinos/MonosChinos.kt" line_range="110-115" />
<code_context>
SAnime.create().apply {
- title = animeTitle
+ this.title = "$title - Episodio $episodeNumber"
setUrlWithoutDomain(animeUrl)
- description = genre
</code_context>
<issue_to_address>
**suggestion:** Avoid appending the episode label when `episodeNumber` is empty to prevent awkward titles.
When `episodeNumber` is empty, this produces titles like `Foo Bar - Episodio ` with a trailing space. Only append `" - Episodio $episodeNumber"` when `episodeNumber` is non-blank, otherwise use just `title`.
```suggestion
SAnime.create().apply {
val displayTitle = if (episodeNumber.isNotBlank()) {
"$title - Episodio $episodeNumber"
} else {
title
}
this.title = displayTitle
setUrlWithoutDomain(animeUrl)
description = a.selectFirst("div.mt-1 span")?.text()?.trim()
thumbnail_url = a.selectFirst("img.lazy")?.getImageUrl()
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Refactor episode title assignment and restore pagination logic.
Updated selectors for thumbnail and description in anime details parsing.
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.
Summary
This PR updates the MonosChinos anime extension to work with the site's redesigned HTML structure. All selectors have been updated, image loading improved, and video extraction remains unchanged and fully functional.
What Changed
1. Selectors updated for new site design
Popular Anime
li.ficha_efecto a→article a.card-wraph3→h3.card-titleimg→img.lazyLatest Episodes
ul.row.row-cols-* > li.col.mb-4→section:has(h2:contains(Últimos capítulos)) article a.card-wrapdiv.absolute.top-2.5(text like "EP 2")div.mt-1 spana[rel='next']selectorAnime Details
h1.fs-2.text-capitalize.text-light→h1.font-extrabold.d-none.d-sm-flex img.lazy→div.shrink-0 img.lazy#profile-tab-pane .mb-3 p→p[class*="max-w-"]with fallback#tab-info p#profile-tab-pane .badge.bg-secondary→div.flex.gap-2.flex-wrap adiv.absolute.top-3.left-3(checks for "Estreno", "En emisión", "Finalizado")2. Image loading improvements
getImageUrl()to check multiple attributes in order:data-src→data-lazy-src→srcset→srcanime.png3. Synopsis extraction fix
.max-w-\[640px\] p(causedSelectorParseException) withp[class*="max-w-"]#tab-info pfor cases where the primary selector fails4. Thumbnail extraction fix
div.relative[aspect-ratio='2/3'](failed becauseaspect-ratiois CSS, not HTML) withdiv.shrink-05. Video extraction unchanged
Testing
Checklist
isValidUrl)Notes
This PR only restores compatibility with the redesigned website. No new features are added, and the video extraction logic (which was working correctly) has not been modified. The most critical fixes were the synopsis selector (which was throwing
SelectorParseException) and the thumbnail selector (which failed due to CSS attribute selection).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 the MonosChinos Spanish anime extension to match the redesigned website structure and maintain compatibility.
Bug Fixes:
Enhancements:
Build: