Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[TASK] Fix Kagane#3562

Merged
lolamtisch merged 2 commits into
masterMALSync/MALSync:masterfrom
kagane_fixMALSync/MALSync:kagane_fixCopy head branch name to clipboard
Jan 18, 2026
Merged

[TASK] Fix Kagane#3562
lolamtisch merged 2 commits into
masterMALSync/MALSync:masterfrom
kagane_fixMALSync/MALSync:kagane_fixCopy head branch name to clipboard

Conversation

@lolamtisch

@lolamtisch lolamtisch commented Jan 18, 2026

Copy link
Copy Markdown
Member

close #3559

Copilot AI review requested due to automatic review settings January 18, 2026 12:06

Copilot AI 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.

Pull request overview

This PR fixes the Kagane manga site implementation by updating HTML element selectors and enhancing the replaceLinebreaks utility function. The changes address issues with scraping data from the Kagane website, likely due to changes in the site's structure.

Changes:

  • Updated Kagane implementation to use different HTML selectors (title element instead of OpenGraph meta tags, meta[name="description"] instead of og:description)
  • Enhanced replaceLinebreaks function to also collapse multiple spaces and trim results
  • Added service worker bypass in headless tests

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
test/headless/test.js Adds service worker bypass to prevent interference during headless testing
src/pages-chibi/implementations/Kagane/main.ts Updates selectors to match current Kagane website structure and switches from reading meta tags to constructing API URLs for images
src/chibiScript/utilities/stringUtilities.ts Enhances the replaceLinebreaks utility to fix regex usage and add space collapsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

*/
replaceLinebreaks: ($c: ChibiGenerator<string>, replacement: ChibiParam<string> = ' ') => {
return $c.replaceAll('(\n|\r)', replacement);
return $c.replaceRegex('(\n|\r)', replacement).replaceRegex(' +', ' ').trim();

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

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

The regex pattern (\n|\r) does not match Windows-style line breaks \r\n correctly. It will replace both \r and \n separately, resulting in two replacements for a single Windows line break. The pattern should be (\r\n|\n|\r) or [\r\n]+ to properly handle all line break types.

Suggested change
return $c.replaceRegex('(\n|\r)', replacement).replaceRegex(' +', ' ').trim();
return $c.replaceRegex('[\\r\\n]+', replacement).replaceRegex(' +', ' ').trim();

Copilot uses AI. Check for mistakes.
*/
replaceLinebreaks: ($c: ChibiGenerator<string>, replacement: ChibiParam<string> = ' ') => {
return $c.replaceAll('(\n|\r)', replacement);
return $c.replaceRegex('(\n|\r)', replacement).replaceRegex(' +', ' ').trim();

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

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

The change from replaceAll to replaceRegex alters the behavior of the replaceLinebreaks function. The new implementation now also collapses multiple spaces into single spaces and trims the result, which was not part of the original behavior. This could break existing code that depends on the original behavior, particularly if spacing is significant in the context where this function is used. Consider whether this behavioral change is intentional and documented.

Suggested change
return $c.replaceRegex('(\n|\r)', replacement).replaceRegex(' +', ' ').trim();
return $c.replaceAll('\n', replacement).replaceAll('\r', replacement);

Copilot uses AI. Check for mistakes.
Comment on lines 9 to 11
replaceLinebreaks: ($c: ChibiGenerator<string>, replacement: ChibiParam<string> = ' ') => {
return $c.replaceAll('(\n|\r)', replacement);
return $c.replaceRegex('(\n|\r)', replacement).replaceRegex(' +', ' ').trim();
},

Copilot AI Jan 18, 2026

Copy link

Choose a reason for hiding this comment

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

The modified replaceLinebreaks function lacks test coverage. Since this function's behavior has been changed to include additional operations (collapsing multiple spaces and trimming), tests should be added to verify the new behavior works correctly for various inputs including different line break types, multiple consecutive spaces, and strings with leading/trailing whitespace.

Copilot uses AI. Check for mistakes.
@lolamtisch
lolamtisch merged commit ff727ba into master Jan 18, 2026
8 of 9 checks passed
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.

Chapter tracking on kagane.org stopped working

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.