Skip to content

feat(english/asurascans): add Asura Scans novels source - #2647

Merged
rajarsheechatterjee merged 2 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-asurascans-2636
Oct 7, 2026
Merged

rajarsheechatterjee merged 2 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-asurascans-2636

Conversation

@RibatTRW

@RibatTRW RibatTRW commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Adds an English source for the Asura Scans novels section (https://asurascans.com/novels), using the site's public JSON API at api.asurascans.com.

  • Popular/latest list, search, and filters for sort, status and genres
  • Novel page: cover, author, status, genres, summary, and the full chapter list
  • Paid chapters are marked 🔒. A "Hide locked chapters" setting removes them, and opening one shows "This chapter is locked" instead of a blank page
  • Strips a stray paragraph of site navigation text that appears at the end of at least one chapter (Shadow Slave ch. 1)

Closes #2636

How it was tested

  • npm run check:plugin -- plugins/english/asurascans.ts: PASS (popular 20 novels, search 1 result, parseNovel 3160 chapters, parseChapter 11143 chars)
  • Plugin Playground in headless Chromium: popular list with covers, My Slain Dragon Bride novel page (summary, 208 chapters, 63 marked 🔒), chapter 1 text, the locked-chapter error on chapter 208, and a search for "dragon" (2 results)
  • npx prettier --check plugins/english/asurascans.ts and npx eslint plugins/english/asurascans.ts are clean, and npm run build:compile passes. npm run lint still fails on 3 errors in other plugins that are already on master.

Checklist

  • Update version code if an existing plugin was modified (new plugin, 1.0.0)
  • Test changes in Plugin Playground or the app
  • Reference related issues in the PR body (e.g. Closes #xyz)
  • Commit messages follow type(scope): description (e.g. feat(<generator>): add new source)

An AI agent (Claude) wrote this PR and ran the tests above. No human has reviewed it yet.

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds a new novel source plugin for a content site.

Fix the stale hideLocked setting before merging; the cover and cleanup changes are non-blocking improvements.

Findings

  1. P1 Chapter switch has no effect ▶
  2. P2 Exported cover URL breaks ▶
  3. P2 Cleanup can erase prose ▶

Summary

Adds an English Asura Scans source using its public JSON API.

  • Readers can browse and search Asura Scans novels with filters.
  • Novel pages show Asura Scans details and chapter lists.
  • Chapter pages show cleaned text or a locked-chapter message.

Reviews (1) · Last reviewed commit: "feat(english/asurascans): add Asura Scan..." · Reviewed by Greptile

Comment thread plugins/english/asurascans.ts Outdated
apiUrl = 'https://api.asurascans.com/api';
version = '1.0.0';

hideLocked = storage.get('hideLocked');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Chapter switch has no effect

hideLocked is read once when the plugin loads. Changing the switch updates storage, but parseNovel keeps using the old value, so refreshing the novel does not apply the setting. Read storage.get('hideLocked') inside parseNovel instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aafeba6: parseNovel now reads storage.get('hideLocked') on each call instead of a class field. In the playground I set the key in plugin storage and re-fetched Black Badger without reloading. It showed 100 chapters (50 🔒) with the key unset, 50 (0 🔒) with it on, and 100 (50 🔒) with it off again.

(Reply and fix by an AI agent, Claude.)

Comment thread plugins/english/asurascans.ts Outdated
return $('body').html() || '';
}

resolveUrl = (path: string) => `${this.site}/${path}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Exported cover URL breaks

resolveUrl prefixes absolute URLs with this.site. EPUB export calls this method with sourceNovel.cover, so an absolute cover URL becomes https://asurascans.com/https://.... This also breaks the absolute defaultCover used when a novel has no cover. Return absolute URLs unchanged before joining relative paths.

Suggested change
resolveUrl = (path: string) => `${this.site}/${path}`;
resolveUrl = (path: string) =>
/^https?:\/\//i.test(path)
? path
: `${this.site}/${path.replace(/^\/+/, '')}`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aafeba6 using your suggestion: absolute http(s) URLs are returned unchanged, and relative paths are joined to this.site with leading slashes stripped. A local fixture check confirms a CDN cover URL passes through unchanged and that novels/<slug> and /novels/<slug>/chapter/1 resolve to https://asurascans.com/....

(Reply and fix by an AI agent, Claude.)

Comment thread plugins/english/asurascans.ts Outdated
Comment on lines +174 to +176
$('p')
.filter((_, el) => $(el).text().includes('Back to homepage'))
.remove();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Cleanup can erase prose

The navigation cleanup deletes every paragraph containing Back to homepage, anywhere in the chapter. That can also delete real prose containing those words. Limit the removal to the known trailing navigation block, and add a fixture that keeps those words inside an ordinary paragraph.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in aafeba6: cleanup moved to cleanChapter, which now removes only trailing paragraphs that contain both Back to homepage and Reporting chapter:, the leaked nav/report-dialog block. The repo has no unit-test suite, so I ran a local fixture script against the bundled plugin rather than committing a test. The real Shadow Slave ch. 1 payload drops only that last paragraph (97 → 96). It keeps a mid-chapter paragraph containing Back to homepage, a final prose paragraph containing it, and a nav-like paragraph that is not last.

(Reply and fix by an AI agent, Claude.)

Read the hideLocked setting on each parseNovel call, return absolute URLs
unchanged from resolveUrl, and only strip the trailing leaked navigation
paragraph from chapter text.
@rajarsheechatterjee
rajarsheechatterjee merged commit 1e5197b into lnreader:master Oct 7, 2026
3 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.

Asura Scans Novels

2 participants