Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [Novel Updates]: Automatic List Tracking #1060

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/plugins/english/novelupdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Plugin } from '@typings/plugin';
class NovelUpdates implements Plugin.PluginBase {
id = 'novelupdates';
name = 'Novel Updates';
version = '0.7.1';
version = '0.8.0';
icon = 'src/en/novelupdates/icon.png';
customCSS = 'src/en/novelupdates/customCSS.css';
site = 'https://www.novelupdates.com/';
Expand Down Expand Up @@ -159,10 +159,11 @@ class NovelUpdates implements Plugin.PluginBase {
chapterName = chapterName.replace(/\b\w/g, l => l.toUpperCase()).trim();
const chapterUrl =
'https:' + loadedCheerio(el).find('a').first().next().attr('href');
const chapterId = chapterUrl.split('/').filter(Boolean).pop();

chapter.push({
name: chapterName,
path: chapterUrl.replace(this.site, ''),
path: `${chapterUrl.replace(this.site, '')},${chapterId},${novelId}`,
});
});

Expand Down Expand Up @@ -582,6 +583,10 @@ class NovelUpdates implements Plugin.PluginBase {
let chapterContent = '';
let chapterText = '';

const novelId = chapterPath.split(',')[2];
const chapterId = chapterPath.split(',')[1];
chapterPath = chapterPath.split(',')[0];

const result = await fetchApi(this.site + chapterPath);
const body = await result.text();
const url = result.url;
Expand Down Expand Up @@ -794,6 +799,10 @@ class NovelUpdates implements Plugin.PluginBase {
);
}

await fetchApi(
`${this.site}readinglist_update.php?rid=${chapterId}&sid=${novelId}&checked=yes`,
);

return chapterText;
}

Expand Down
Loading