Skip to content

Add Po18csParser - #2854

Merged
gamebeaker merged 4 commits into
dteviot:ExperimentalTabModefrom
Yomafil:feat/add-Po18csParser
Aug 2, 2026
Merged

Add Po18csParser#2854
gamebeaker merged 4 commits into
dteviot:ExperimentalTabModefrom
Yomafil:feat/add-Po18csParser

Conversation

@Yomafil

@Yomafil Yomafil commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Add new parser for site https://www.po18cs.com #1644

We get the missing chapter links from the next chapter button present in the previous chapter.
Short book: https://www.po18cs.com/book/126352/

Also added a new function in ChapterUrlsUI monoShowTocProgress to show the ToC Progress for individual chapter instead of multiple at once, as we are only getting one chapter at a time and showTocProgress only takes in a list of chapters.
Useful to track the progress for large books: https://www.po18cs.com/book/6/

@Yomafil

Yomafil commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

It should also be possible to pass the chapter as an array of 1 into showTocProgress instead of using the new monoShowTocProgress if we don't want to make a new function.

async getChapterUrls(dom, chapterUrlsUI) {
        let menu = [...dom.querySelectorAll("dd.col-md-3")];

        let chapters = [];
        let prevChapUrl = null;

        for (let el of menu) {
            let anchor = el.querySelector("a");

            let chapter = null;

            if (anchor) {
                prevChapUrl = anchor.href;

                chapter = {
                    sourceUrl: anchor.href,
                    title: el.textContent.trim(),
                    isIncludeable: true,
                };

                chapters.push(chapter);

                chapter = [chapter];

                chapterUrlsUI.showTocProgress(chapter);

                continue;
            }

            //Handle missing chapter link in toc
            await this.rateLimitDelay();
            let options = { parser: this };
            let prevChapDom = (await HttpClient.wrapFetch(prevChapUrl, options)).responseXML; 

            let nextChapAnchor = prevChapDom.querySelector("#linkNext");

            prevChapUrl = nextChapAnchor.href;

            chapter = {
                sourceUrl: nextChapAnchor.href,
                title: el.textContent.trim(),
                isIncludeable: true,
            };

            chapters.push(chapter);

            chapter = [chapter];
            
            chapterUrlsUI.showTocProgress(chapter);
        }

        return chapters;
    }
    ```

@gamebeaker

Copy link
Copy Markdown
Collaborator

@Yomafil i removed monoShowTocProgress as the change to call the original is a simple [] wrap.

@gamebeaker
gamebeaker merged commit 0672581 into dteviot:ExperimentalTabMode Aug 2, 2026
1 check 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.

2 participants