Merge pull request #321 from entityJY/main

Add extension for webnoveltranslations.com
This commit is contained in:
Moustapha Kodjo Amadou
2025-09-20 07:34:24 +01:00
committed by GitHub
5 changed files with 155 additions and 7 deletions

View File

@@ -1,9 +1,7 @@
name: Generate json index name: Generate json index
on: on:
push: workflow_dispatch
branches:
- main
jobs: jobs:
build: build:
@@ -26,7 +24,6 @@ jobs:
git config --local user.name "github-actions[bot]" git config --local user.name "github-actions[bot]"
git checkout main git checkout main
git add index.json git add index.json
git add anime_index.json
git add novel_index.json git add novel_index.json
if git diff --cached --quiet; then if git diff --cached --quiet; then
echo "No changes detected, skipping commit." echo "No changes detected, skipping commit."

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,151 @@
const mangayomiSources = [{
"name": "Web Novel Translations",
"lang": "en",
"baseUrl": "https://webnoveltranslations.com",
"apiUrl": "",
"iconUrl": "https://webnoveltranslations.com/wp-content/uploads/2025/03/wnt-logo-4.png",
"typeSource": "single",
"itemType": 2,
"version": "1.0.0",
"pkgPath": "novel/src/en/webnoveltranslations.js",
"notes": ""
}];
class DefaultExtension extends MProvider {
mangaListFromPage(res) {
const doc = new Document(res.body);
const mangaElements = doc.select(".row.c-tabs-item__content");
const list = [];
for (const element of mangaElements) {
const name = element.selectFirst("h3")?.text.trim();
const imageUrl = element.selectFirst("img").getSrc;
const link = element.selectFirst(".tab-thumb.c-image-hover > a").getHref;
list.push({ name, imageUrl, link });
}
const hasNextPage = false;
return { list: list, hasNextPage };
}
getHeaders(url) {
throw new Error("getHeaders not implemented");
}
async getPopular(page) {
let url = `${this.source.baseUrl}/?s=&post_type=wp-manga`;
const res = await new Client().get(url, this.headers);
return this.mangaListFromPage(res);
}
get supportsLatest() {
throw new Error("supportsLatest not implemented");
}
async getLatestUpdates(page) {
throw new Error("getLatestUpdates not implemented");
let url = this.source.baseUrl;
const res = await new Client().get(url, this.headers);
const doc = new Document(res.body);
const mangaElements = doc.select("#loop-content > div");
const list = [];
for (const element of mangaElements) {
const name = element.selectFirst("div.post-title.font-title")?.text.trim();
const imageUrl = element.selectFirst("img").getSrc;
const link = element.selectFirst(".item-summary > a").getHref;
list.push({ name, imageUrl, link });
}
const hasNextPage = false;
return { list: list, hasNextPage };
}
async search(query, page, filters) {
let url = `${this.source.baseUrl}/?s=${query}&post_type=wp-manga`;
const res = await new Client().get(url, this.headers);
return this.mangaListFromPage(res);
}
async getDetail(url) {
const client = new Client();
const res = await client.get(url, this.headers);
const doc = new Document(res.body);
const main = doc.selectFirst('.site-content');
const name = doc.selectFirst("div.post-title > h1").text.trim();;
const link = url;
let description = "";
for (const element of doc.select(".summary__content > p")) {
description += element.text;
}
const genre = doc.select("div.genres-content > a").map((el) => el.text.trim());
const author = doc.selectFirst("div.author-content > a").text.trim();
const status_string = doc.selectFirst("div.post-status > div.summary-content")?.text.trim();
let status = -1;
if (status_string === "OnGoing") {
status = 0;
} else {
status = 5;
}
const chapterRes = await client.post(url + "ajax/chapters/?t=1", {"x-requested-with": "XMLHttpRequest"});
const chapterDoc = new Document(chapterRes.body);
let chapters = [];
for (const chapter of chapterDoc.select("li.wp-manga-chapter ")) {
chapters.push({
name: chapter.selectFirst("a").text.trim(),
url: chapter.selectFirst("a").getHref,
dateUpload: null,
scanlator: null,
});
}
return {
name,
link,
description,
genre,
author,
status,
chapters,
};
}
// For novel html content
async getHtmlContent(name, url) {
const client = await new Client();
const res = await client.get(url);
const html = await this.cleanHtmlContent(res.body);
return html;
}
// Clean html up for reader
async cleanHtmlContent(html) {
const doc = new Document(html);
const title = doc.selectFirst("#chapter-heading")?.text.trim() || "";
const content = doc.select("#novel-chapter-container.text-left > p");
let chapterContent = "";
for (const line of content) {
chapterContent += "<p>" + line.text + "</p>";
};
return `<h2>${title}</h2><hr><br>${chapterContent}`;
}
// For anime episode video list
async getVideoList(url) {
throw new Error("getVideoList not implemented");
}
// For manga chapter pages
async getPageList(url) {
throw new Error("getPageList not implemented");
}
getFilterList() {
throw new Error("getFilterList not implemented");
}
getSourcePreferences() {
throw new Error("getSourcePreferences not implemented");
}
}

View File

@@ -1 +1 @@
[{"name":"Novel Updates","id":413730324,"baseUrl":"https://www.novelupdates.com","lang":"en","typeSource":"single","iconUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.novelupdates.png","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":true,"sourceCodeUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/novel/src/en/novelupdates.js","apiUrl":"","version":"0.0.4","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.5.0","additionalParams":"","sourceCodeLanguage":1,"notes":"This extension requires you to login to view the chapters!"},{"name":"Wordrain69","id":422341482,"baseUrl":"https://wordrain69.com","lang":"en","typeSource":"single","iconUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.wordrain69.png","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":false,"sourceCodeUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/novel/src/en/wordrain69.js","apiUrl":"","version":"0.0.4","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.5.0","additionalParams":"","sourceCodeLanguage":1,"notes":""},{"name":"ملوك الروايات","id":756554088,"baseUrl":"https://kolnovel.com","lang":"ar","typeSource":"single","iconUrl":"https://www.google.com/s2/favicons?sz=256&domain=https://kolnovel.com","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":false,"sourceCodeUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/novel/src/ar/kolnovel.js","apiUrl":"","version":"0.0.1","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.5.0","additionalParams":"","sourceCodeLanguage":1,"notes":""},{"name":"Annas Archive","id":114216145,"baseUrl":"https://annas-archive.org","lang":"en","typeSource":"single","iconUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.annasarchive.png","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":true,"sourceCodeUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/novel/src/all/annasarchive.js","apiUrl":"","version":"0.0.1","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.6.1","additionalParams":"","sourceCodeLanguage":1,"notes":"EPUBs are automatically downloaded to view chapters! Downloads from Libgen might be slow!"}] [{"name":"ملوك الروايات","id":756554088,"baseUrl":"https://kolnovel.com","lang":"ar","typeSource":"single","iconUrl":"https://www.google.com/s2/favicons?sz=256&domain=https://kolnovel.com","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":false,"sourceCodeUrl":"https://raw.githubusercontent.com/entityJY/mangayomi-extensions-eJ/main/javascript/novel/src/ar/kolnovel.js","apiUrl":"","version":"0.0.1","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.5.0","additionalParams":"","sourceCodeLanguage":1,"notes":""},{"name":"Annas Archive","id":114216145,"baseUrl":"https://annas-archive.org","lang":"en","typeSource":"single","iconUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.annasarchive.png","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":true,"sourceCodeUrl":"https://raw.githubusercontent.com/entityJY/mangayomi-extensions-eJ/main/javascript/novel/src/all/annasarchive.js","apiUrl":"","version":"0.0.1","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.6.1","additionalParams":"","sourceCodeLanguage":1,"notes":"EPUBs are automatically downloaded to view chapters! Downloads from Libgen might be slow!"},{"name":"Wordrain69","id":422341482,"baseUrl":"https://wordrain69.com","lang":"en","typeSource":"single","iconUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.wordrain69.png","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":false,"sourceCodeUrl":"https://raw.githubusercontent.com/entityJY/mangayomi-extensions-eJ/main/javascript/novel/src/en/wordrain69.js","apiUrl":"","version":"0.0.4","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.5.0","additionalParams":"","sourceCodeLanguage":1,"notes":""},{"name":"Web Novel Translations","id":1063819370,"baseUrl":"https://webnoveltranslations.com","lang":"en","typeSource":"single","iconUrl":"https://webnoveltranslations.com/wp-content/uploads/2025/03/wnt-logo-4.png","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":false,"sourceCodeUrl":"https://raw.githubusercontent.com/entityJY/mangayomi-extensions-eJ/main/javascript/novel/src/en/webnoveltranslations.js","apiUrl":"","version":"1.0.0","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.5.0","additionalParams":"","sourceCodeLanguage":1,"notes":""},{"name":"Novel Updates","id":413730324,"baseUrl":"https://www.novelupdates.com","lang":"en","typeSource":"single","iconUrl":"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.novelupdates.png","dateFormat":"","dateFormatLocale":"","isNsfw":false,"hasCloudflare":true,"sourceCodeUrl":"https://raw.githubusercontent.com/entityJY/mangayomi-extensions-eJ/main/javascript/novel/src/en/novelupdates.js","apiUrl":"","version":"0.0.4","isManga":false,"itemType":2,"isFullData":false,"appMinVerReq":"0.5.0","additionalParams":"","sourceCodeLanguage":1,"notes":"This extension requires you to login to view the chapters!"}]

View File

@@ -69,7 +69,7 @@ List<Source> _searchJsSources(Directory dir) {
..appMinVerReq = ..appMinVerReq =
sourceJson["appMinVerReq"] ?? defaultSource.appMinVerReq sourceJson["appMinVerReq"] ?? defaultSource.appMinVerReq
..sourceCodeUrl = ..sourceCodeUrl =
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/javascript/${sourceJson["pkgPath"] ?? sourceJson["pkgName"]}"; "https://raw.githubusercontent.com/entityJY/mangayomi-extensions-eJ/$branchName/javascript/${sourceJson["pkgPath"] ?? sourceJson["pkgName"]}";
if (sourceJson["id"] != null) { if (sourceJson["id"] != null) {
source = source..id = int.tryParse("${sourceJson["id"]}"); source = source..id = int.tryParse("${sourceJson["id"]}");
} }