Skip to content
Open
Show file tree
Hide file tree
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
Binary file added Module Parser KETSU/Asura/Chapters/.DS_Store
Binary file not shown.
87 changes: 87 additions & 0 deletions Module Parser KETSU/Asura/Chapters/Chapters.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

<script type="text/javascript">
function Chapters(request, extra, javascriptConfig, output) {
this.request = request;
this.extra = extra;
this.javascriptConfig = javascriptConfig;
this.output = output;
}

function ModuleRequest(url, method, headers, httpBody) {
this.url = url;
this.method = method;
this.headers = headers;
this.httpBody = httpBody;
}

function Extra(commands, extraInfo) {
this.commands = commands;
this.extraInfo = extraInfo;
}

function Commands(commandName, params) {
this.commandName = commandName;
this.params = params;
}

function JavascriptConfig(removeJavascript, loadInWebView, javaScript) {
this.removeJavascript = removeJavascript;
this.loadInWebView = loadInWebView;
this.javaScript = javaScript;
}

function KeyValue(key, value) {
this.key = key;
this.value = value;
}

function Output( videos, images, text) {
this.videos = videos;
this.images = images;
this.text = text;
}

function Videos(needsResolver, rawVideo) {
this.needsResolver = needsResolver;
this.rawVideo = rawVideo;
}

function NeedsResolver(resolverIdentifier, link) {
this.resolverIdentifier = resolverIdentifier;
this.link = link;
}

function RawVideo(video) {
this.video = video;
}

function Video(videoQuality, videoLink) {
this.videoQuality = videoQuality;
this.videoLink = videoLink;
}



function Text(text) {
this.text = text;
}

var output = [];
var savedData = document.getElementById('ketsu-final-data');
var parsedJson = JSON.parse(savedData.innerHTML);

var emptyKeyValue = [new KeyValue('', '')];

var images = document.querySelectorAll('p > img');
for (var x = 1; x < images.length - 1; x++) {
var img = images[x].src;
output.push(new ModuleRequest(img,'get',emptyKeyValue,null));
}

let emptyExtra = new Extra([new Commands('', emptyKeyValue)], emptyKeyValue);
var chaptersObject = new Chapters(new ModuleRequest('', '', emptyKeyValue, null), emptyExtra, new JavascriptConfig(false, false, ''),
new Output(null, output, null));
var finalJson = JSON.stringify(chaptersObject);
savedData.innerHTML = finalJson;

</script>
Binary file added Module Parser KETSU/Asura/Info/.DS_Store
Binary file not shown.
99 changes: 99 additions & 0 deletions Module Parser KETSU/Asura/Info/Info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
function Info(request, extra, javascriptConfig, output) {
this.request = request;
this.extra = extra;
this.javascriptConfig = javascriptConfig;
this.output = output;
}

function ModuleRequest(url, method, headers, httpBody) {
this.url = url;
this.method = method;
this.headers = headers;
this.httpBody = httpBody;
}

function Extra(commands, extraInfo) {
this.commands = commands;
this.extraInfo = extraInfo;
}

function Commands(commandName, params) {
this.commandName = commandName;
this.params = params;
}

function JavascriptConfig(removeJavascript, loadInWebView, javaScript) {
this.removeJavascript = removeJavascript;
this.loadInWebView = loadInWebView;
this.javaScript = javaScript;
}

function KeyValue(key, value) {
this.key = key;
this.value = value;
}

function Chapter(chapName, link, openInWebView) {
this.chapName = chapName;
this.link = link;
this.openInWebView = openInWebView;
}

function Output(image, title, link, description, genres, field1, field2, field3, field4, chapters) {
this.image = image;
this.link = link;
this.title = title;
this.description = description;
this.genres = genres;
this.field1 = field1;
this.field2 = field2;
this.field3 = field3;
this.field4 = field4;
this.chapters = chapters;
}

function getStuff(array, match) {
for (var x = 0; x < array.length; x++) {
let data = array[x].innerText;
if (data.includes(match)) {
return data.replace(match, '').trim();
}
}
}

function getHtmlStuff(array, match) {
for (var x = 0; x < array.length; x++) {
let data = array[x].innerText;
if (data.includes(match)) {
return array[x];
}
}
}
var savedData = document.getElementById('ketsu-final-data');
var parsedJson = JSON.parse(savedData.innerHTML);
let emptyKeyValue = [new KeyValue('', '')];
var episodes = [];
var type = document.querySelector('div.tsinfo > div:nth-child(2) a').textContent;
var status = document.querySelector('div.tsinfo > div:nth-child(1) i').textContent;
var genres = [];
genres = Array.from(document.querySelectorAll('.wd-full a')).map(g => g.textContent);
var desc;
try {
desc = document.querySelector('[itemprop=\"depion\"]').textContent.replaceAll('\n','').trim();
} catch{}
var title = document.querySelector('.entry-title').textContent.trim();
var image = document.querySelector('.thumb img').src;
image = new ModuleRequest(image, 'get', emptyKeyValue, null);
var chapters = document.querySelector('.clstyle').querySelectorAll('li');
for (var i = chapters.length - 1; i >= 0; i--) {
var element = chapters[i];
var fixedLink = element.querySelector('a').href;
let chapter = new Chapter('Chapter ' + (chapters.length - i), new ModuleRequest(fixedLink, 'get',
emptyKeyValue, null), false);
episodes.push(chapter);
}
let infoPageObject = new Info(new ModuleRequest('', '', emptyKeyValue, null), new Extra([new Commands('',
emptyKeyValue)], emptyKeyValue), new JavascriptConfig(false, false, ''), new Output(image, title,
parsedJson.request, desc, genres, status, type, '', 'Chapters : ' + episodes.length, episodes));
var finalJson = JSON.stringify(infoPageObject);
savedData.innerHTML = finalJson;
Loading