-
Notifications
You must be signed in to change notification settings - Fork 471
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
Add CoroCoro connector #7472
base: master
Are you sure you want to change the base?
Add CoroCoro connector #7472
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work but
-
Dont assume the script you want is the nth script in all the page scripts. Perform checks on the script content instead.
-
I dont like those eval at all. If you want to use eval perhaps you should use them in browser context i.e injecting a script using
Engine.Request.fetchUI
. Perhaps is event easier this way, if you are able to parse next_f array idk.
async _getMangas() { | ||
/** @type {HTMLScriptElement[]} */ | ||
const scripts = await this.fetchDOM(this.url + '/rensai', 'script'); | ||
for (const scriptElem of scripts.reverse()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to loop by yourself if you can identify the script by content
const scripts = [...document.querySelectorAll('script')];
const script = scripts.find(script=> script.innerText.indexOf('totalChapterLikes') > 0)?.innerText;
const json = JSON.parse(script.substring(22, script.length - 2));
const data = JSON.parse(json.substring(json.indexOf(':') + 1))[3]['children'][3]['weekdays'];
const script = scriptElem.innerText; | ||
try { | ||
/** @type {string} */ | ||
const json = JSON.parse(script.substring(22, script.length - 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, since JSON parsing first steps are the same perhaps we should make a function?
function findAndParseJSON(scripts, textToFind) {
const script = scripts.find(script=> script.innerText.indexOf(textToFind) > 0)?.innerText;
const json = JSON.parse(script.substring(22, script.length - 2));
return JSON.parse(json.substring(json.indexOf(':') + 1))
}
const scripts = [...document.querySelectorAll('script')];
const data = findAndParseJSON( scripts, 'weekdays');
The "allow edits by maintainers" checkbox is checked, since you're already writing full snippets of fixed code in your comments you might as well commit them. |
I have no time to spare and no intention to add such complex website to Hakuneko anymore. Its better for the team and for everyone to spend time on Haruneko where this website was added and working until its last update. |
Suggestion to close PR after Thursday, 2 January 2025 (12 weeks) if not approved by a reviewer. |
Ooooh, they use protobuff now? awesome, gotta review that asap <3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work with the prototypes.
Some things still must be changed tho.
} | ||
|
||
/** | ||
* @param {URL} uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment should be removed as its content can easily be inferred from the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same everywhere else
No description provided.