Initial commit
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
function download(filename, text) {
|
||||
let element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
async function getChapter(chapterUrl){
|
||||
let chapterDownload = await fetch(chapterUrl, {
|
||||
"headers": {
|
||||
"sec-ch-ua": "\"Chromium\";v=\"88\", \"Google Chrome\";v=\"88\", \";Not A Brand\";v=\"99\"",
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"upgrade-insecure-requests": "1"
|
||||
},
|
||||
"referrer": "https://fastnovel.net/nanomancer-reborn-ive-become-a-snow-girl2-156/",
|
||||
"referrerPolicy": "strict-origin-when-cross-origin",
|
||||
"body": null,
|
||||
"method": "GET",
|
||||
"mode": "cors",
|
||||
"credentials": "omit"
|
||||
});
|
||||
|
||||
if (chapterDownload.ok) {
|
||||
let response = await chapterDownload.text();
|
||||
document.open();
|
||||
document.write(response);
|
||||
document.close()
|
||||
|
||||
let title = document.querySelector("h1.episode-name");
|
||||
let matched = title.textContent.match(/(Chapter.*)/g);
|
||||
title.innerHTML = matched[0];
|
||||
let content = document.querySelector("div#chapter-body");
|
||||
content.prepend(title);
|
||||
content.innerHTML = content.innerHTML.replaceAll("…","...").replace(/Find authorized novels.*for visiting/g, "").replace(/([A-z])\.([A-z])/g, function (match, p1, p2, offset, string){return p1+p2;}).replace(/([A-z])\.([A-z])/g, function (match, p1, p2, offset, string){return p1+p2;});
|
||||
|
||||
return content.innerHTML;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Start file download.
|
||||
//download("hello.txt","This is the content of my file :)");
|
||||
async function main()
|
||||
{
|
||||
let volumeLinks = ["", []]
|
||||
let chapters = document.querySelectorAll("div.book ul a");
|
||||
let volumes = [[]];
|
||||
let perVolume = 100;
|
||||
let title = document.querySelector("h1.name").textContent;
|
||||
let author = document.querySelector("ul.meta-data>li a").textContent;
|
||||
|
||||
console.log(chapters.length / perVolume + 1);
|
||||
|
||||
for(vol = 0; vol < Math.ceil(chapters.length/perVolume); vol++)
|
||||
{
|
||||
let chapterLinks = [];
|
||||
|
||||
for(chap = 0; chap < perVolume && vol * perVolume + chap < chapters.length; chap++)
|
||||
{
|
||||
let chapIndex = vol * perVolume + chap;
|
||||
chapterLinks[chapters[chapIndex].text] = chapters[chapIndex].href;
|
||||
}
|
||||
|
||||
volumeLinks[vol] = ["Volume " + (vol + 1), chapterLinks];
|
||||
}
|
||||
|
||||
//console.log(volumeLinks);
|
||||
|
||||
for (volume in volumeLinks) {
|
||||
//if(volumeLinks[volume][0] == "Volume 10")
|
||||
//{
|
||||
let toDownload = ""
|
||||
|
||||
for (link in volumeLinks[volume][1]) {
|
||||
//console.log(link)
|
||||
if (volumeLinks[volume][1][link] != undefined) {
|
||||
//console.log(volumeLinks[volume][1][link])
|
||||
toDownload += await getChapter(volumeLinks[volume][1][link]);
|
||||
}
|
||||
//console.log(download)
|
||||
}
|
||||
|
||||
let volumeName = volumeLinks[volume][0].replaceAll(": "," ").replaceAll(":","").replaceAll(" - "," ").replace(/Volume (\d)\b/,"Volume 0$1");
|
||||
download(title + " - " + volumeName + " - " + author + ".html", toDownload)
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,90 @@
|
||||
function download(filename, text) {
|
||||
let element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
async function getChapter(chapterUrl){
|
||||
let chapterDownload = await fetch(chapterUrl, {
|
||||
"headers": {
|
||||
"sec-ch-ua": "\"Chromium\";v=\"88\", \"Google Chrome\";v=\"88\", \";Not A Brand\";v=\"99\"",
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"upgrade-insecure-requests": "1"
|
||||
},
|
||||
"referrer": "https://fastnovel.net/nanomancer-reborn-ive-become-a-snow-girl2-156/",
|
||||
"referrerPolicy": "strict-origin-when-cross-origin",
|
||||
"body": null,
|
||||
"method": "GET",
|
||||
"mode": "cors",
|
||||
"credentials": "omit"
|
||||
});
|
||||
|
||||
if (chapterDownload.ok) {
|
||||
let response = await chapterDownload.text();
|
||||
document.open();
|
||||
document.write(response);
|
||||
document.close()
|
||||
|
||||
let title = document.querySelector("h1.episode-name");
|
||||
let matched = title.textContent.match(/(Chapter.*)/g);
|
||||
title.innerHTML = matched[0];
|
||||
let content = document.querySelector("div#chapter-body");
|
||||
content.prepend(title);
|
||||
content.innerHTML = content.innerHTML.replaceAll("…","...").replace(/Find authorized novels.*for visiting/g, "").replace(/([A-z])\.([A-z])/g, function (match, p1, p2, offset, string){return p1+p2;}).replace(/([A-z])\.([A-z])/g, function (match, p1, p2, offset, string){return p1+p2;});
|
||||
|
||||
return content.innerHTML;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Start file download.
|
||||
//download("hello.txt","This is the content of my file :)");
|
||||
async function main()
|
||||
{
|
||||
let volumeLinks = ["", []]
|
||||
let volumes = document.querySelectorAll("div.book");
|
||||
let title = document.querySelector("h1.name").textContent;
|
||||
let author = document.querySelector("ul.meta-data>li a").textContent;
|
||||
|
||||
for (volume = 0; volume < volumes.length; volume++) {
|
||||
let chapterLinks = [];
|
||||
let chapters = volumes[volume].querySelectorAll("ul a");
|
||||
|
||||
for (chapter in chapters) {
|
||||
chapterLinks[chapters[chapter].text] = chapters[chapter].href;
|
||||
}
|
||||
|
||||
volumeLinks[volume] = [volumes[volume].querySelectorAll("a")[0].text, chapterLinks];
|
||||
}
|
||||
|
||||
for (volume in volumeLinks) {
|
||||
var volumeNumber = volumeLinks[volume][0].match(/^.* (\d+)/)[1];
|
||||
|
||||
if(volumeNumber >= 10) //0 for all
|
||||
{
|
||||
let toDownload = ""
|
||||
|
||||
for (link in volumeLinks[volume][1])
|
||||
{
|
||||
if (volumeLinks[volume][1][link] != undefined)
|
||||
{
|
||||
//console.log(volumeLinks[volume][1][link])
|
||||
toDownload += await getChapter(volumeLinks[volume][1][link]);
|
||||
}
|
||||
}
|
||||
|
||||
//download("Nanomancer Reborn - " + volumeLinks[volume][0] + ".html", toDownload)
|
||||
let volumeName = volumeLinks[volume][0].replaceAll(": "," ").replaceAll(":","").replaceAll(" - "," ").replace(/Volume (\d)\b/,"Volume 0$1");
|
||||
download(title + " - " + volumeName + " - " + author + ".html", toDownload)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,99 @@
|
||||
function download(filename, text) {
|
||||
let element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
async function getChapter(chapterUrl){
|
||||
let chapterDownload = await fetch(chapterUrl);
|
||||
|
||||
if (chapterDownload.ok) {
|
||||
let response = await chapterDownload.text();
|
||||
//document.open();
|
||||
//document.write(response);
|
||||
//document.close()
|
||||
document.getElementsByTagName("html")[0].innerHTML = response;
|
||||
|
||||
await new Promise(r => setTimeout(r, 100));
|
||||
|
||||
let title = document.createElement("h1");
|
||||
title.innerHTML = document.querySelector("div.titles h2").innerText;
|
||||
let content = document.querySelector("#chapter-container");
|
||||
content.prepend(title);
|
||||
content.querySelectorAll("#chapter-container div").forEach(function(e){e.remove();});
|
||||
content.querySelectorAll("#chapter-container p").forEach(function(e){if(e.classList.length > 0)e.remove();});
|
||||
content.innerHTML = content.innerHTML.replaceAll("…","...").replace(/([A-z])\.([A-z])/g, function (match, p1, p2, offset, string){return p1+p2;}).replace(/([A-z])\.([A-z])/g, function (match, p1, p2, offset, string){return p1+p2;});
|
||||
|
||||
return content.innerHTML;
|
||||
}
|
||||
}
|
||||
|
||||
function appendLog(log)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
async function main()
|
||||
{
|
||||
let startChapter = 951;
|
||||
let endChapter = 1100; // 0/false = until last
|
||||
let perVolume = 50; // 0/false = all in one
|
||||
var debug = false;
|
||||
let volumeLinks = ["", []]
|
||||
let title = document.querySelector("h1.novel-title").innerText.replaceAll(" (WN)", "").replaceAll(" (LN)", "");
|
||||
let author = document.querySelector("div.author > a > span").innerText;
|
||||
|
||||
endChapter = endChapter ? endChapter : document.querySelector("#chapters > div.intro > a").innerText.match(/\d+/)[0];
|
||||
perVolume = perVolume ? perVolume : Number.MAX_VALUE;
|
||||
|
||||
if(debug) console.log(endChapter + " " + perVolume);
|
||||
|
||||
for(vol = Math.ceil(startChapter/perVolume); vol <= Math.ceil(endChapter/perVolume); vol++)
|
||||
{
|
||||
let chapterLinks = [];
|
||||
|
||||
for(chap = ((vol - 1) * perVolume) + ( vol == Math.ceil(startChapter/perVolume) ? startChapter % perVolume : 1); chap <= vol * perVolume && chap <= endChapter; chap++)
|
||||
{
|
||||
let chapIndex = vol * perVolume + chap;
|
||||
chapterLinks[chap] = window.location.href + "/chapter-"+chap;
|
||||
if(debug) console.log(chapterLinks[chap]);
|
||||
}
|
||||
|
||||
volumeLinks[vol] = ["Volume " + (vol), chapterLinks];
|
||||
}
|
||||
|
||||
if(debug) console.log(volumeLinks);
|
||||
|
||||
var antiSpam = 1
|
||||
for(volume = Math.ceil(startChapter/perVolume); volume <= Math.ceil(endChapter/perVolume); volume++)
|
||||
{
|
||||
if(debug) console.log(volume);
|
||||
let toDownload = ""
|
||||
|
||||
for(link = ((volume - 1) * perVolume) + 1; link <= volume * perVolume && link <= endChapter; link++)
|
||||
{
|
||||
if(debug) console.log(volumeLinks[volume][1][link]);
|
||||
if (volumeLinks[volume][1][link] != undefined) {
|
||||
if(!debug) toDownload += await getChapter(volumeLinks[volume][1][link]);
|
||||
if(antiSpam % 30 == 0)
|
||||
{
|
||||
console.log("antispam")
|
||||
await new Promise(r => setTimeout(r, 65000));
|
||||
}
|
||||
++antiSpam;
|
||||
}
|
||||
}
|
||||
|
||||
let volumeName = volumeLinks[volume][0].replace(/Volume (\d)\b/,"Volume 0$1");
|
||||
if(!debug) download(title + " - " + volumeName + " - " + author + ".html", toDownload)
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,98 @@
|
||||
function download(filename, text) {
|
||||
let element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
async function getChapter(chapterUrl){
|
||||
let chapterDownload = await fetch(chapterUrl, {
|
||||
"headers": {
|
||||
"sec-ch-ua": "\"Chromium\";v=\"88\", \"Google Chrome\";v=\"88\", \";Not A Brand\";v=\"99\"",
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"upgrade-insecure-requests": "1"
|
||||
},
|
||||
"referrer": "https://fastnovel.net/nanomancer-reborn-ive-become-a-snow-girl2-156/",
|
||||
"referrerPolicy": "strict-origin-when-cross-origin",
|
||||
"body": null,
|
||||
"method": "GET",
|
||||
"mode": "cors",
|
||||
"credentials": "omit"
|
||||
});
|
||||
|
||||
if (chapterDownload.ok) {
|
||||
let response = await chapterDownload.text();
|
||||
document.open();
|
||||
document.write(response);
|
||||
document.close()
|
||||
|
||||
document.querySelectorAll("div.chapter-content3 div.desc div").forEach(function(elem) {elem.remove()});
|
||||
document.querySelectorAll("div.chapter-content3 div.desc script").forEach(function(elem) {elem.remove()});
|
||||
document.querySelectorAll("div.chapter-content3 div.desc center").forEach(function(elem) {elem.remove()});
|
||||
document.querySelectorAll("div.chapter-content3 div.desc small").forEach(function(elem) {elem.remove()});
|
||||
document.querySelectorAll("div.chapter-content3 div.desc br").forEach(function(elem) {elem.remove()});
|
||||
document.querySelectorAll("div.chapter-content3 div.desc hr").forEach(function(elem) {elem.remove()});
|
||||
let content = document.querySelector("div.chapter-content3 div.desc");
|
||||
console.log("[DEBUG] " + content);
|
||||
content.innerHTML = content.innerHTML.replaceAll("…","...").replace(/Find authorized novels.*for visiting/g, "").replace(/([A-z])\.([A-z])/g, "$1$2").replace(/([A-z])\.([A-z])/g, "$1$2");
|
||||
|
||||
return content.innerHTML;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Start file download.
|
||||
//download("hello.txt","This is the content of my file :)");
|
||||
|
||||
let volumeLinks = ["", []]
|
||||
let chapters = document.querySelectorAll("div.chapters div.tab-content a");
|
||||
let volumes = [[]];
|
||||
let perVolume = 100;
|
||||
let title = document.querySelector("div.block-title h1").textContent;
|
||||
//let author = document.querySelector("body > div:nth-child(4) > div > div > div.col-lg-8.content > div > div:nth-child(2) > div > div.novel-left > div.novel-details > div:nth-child(5) > div.novel-detail-body > ul > li").textContent;
|
||||
let author = "Feng Yise" // Unrivaled Medicine God
|
||||
|
||||
console.log(chapters.length / perVolume + 1);
|
||||
|
||||
for(vol = 0; vol < Math.ceil(chapters.length/perVolume); vol++)
|
||||
{
|
||||
let chapterLinks = [];
|
||||
|
||||
for(chap = 0; chap < perVolume && vol * perVolume + chap < chapters.length; chap++)
|
||||
{
|
||||
let chapIndex = vol * perVolume + chap;
|
||||
chapterLinks[chapters[chapIndex].text] = chapters[chapIndex].href;
|
||||
}
|
||||
|
||||
volumeLinks[vol] = ["Volume " + (vol + 1), chapterLinks];
|
||||
}
|
||||
|
||||
//console.log(volumeLinks);
|
||||
|
||||
for (volume in volumeLinks) {
|
||||
let volumeNumber = volumeLinks[volume][0].match(/Volume (\d+)/)[1];
|
||||
|
||||
if(volumeNumber > 18)
|
||||
{
|
||||
let toDownload = ""
|
||||
|
||||
for (link in volumeLinks[volume][1]) {
|
||||
//console.log(link)
|
||||
if (volumeLinks[volume][1][link] != undefined) {
|
||||
//console.log(volumeLinks[volume][1][link])
|
||||
toDownload += await getChapter(volumeLinks[volume][1][link]);
|
||||
//console.log("[DEBUG] " +toDownload);
|
||||
}
|
||||
//console.log(download)
|
||||
}
|
||||
|
||||
let volumeName = volumeLinks[volume][0].replaceAll(": "," ").replaceAll(":","").replaceAll(" - "," ").replace(/Volume (\d)\b/,"Volume 0$1");
|
||||
download(title + " - " + volumeName + " - " + author + ".html", toDownload)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user