-
Notifications
You must be signed in to change notification settings - Fork 470
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
added new connector 'Hattori Manga' #7386
base: master
Are you sure you want to change the base?
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.
- A lot a things to changes
- This need an icon. 64x64 px, png, no extension to be added in /imgs/connectors.
- This lacks clipboard support. Look for _getMangaFromURI
} | ||
|
||
async _getMangas() { | ||
const mangas = []; |
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.
Prefer a simpler approach
async _getMangas() {
const mangaList = [];
for (let page = 1, run = true; run; page++) {
const mangas = await this._getMangasFromPage(page);
mangas.length > 0 ? mangaList.push(...mangas) : run = false;
}
return mangaList;
}
async _getMangasFromPage(page) {
.....
}
} | ||
|
||
async _getChapters(manga) { | ||
manga.id = manga.id.replace('manga/', ''); |
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.
dont "replace"
Make sure you keep only the needed part when you gather mangas.
let allChapters = []; | ||
let page = 1; | ||
const lastPage = await this._getLastPage(manga.id); | ||
|
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.
Use this.fetchJSON. you can even use it to populate many variables directly
const chapterList= [];
for (let page = 1, run = true; run = false; page ++ {
const { chapters, lastPage } = await this.fetchJSON(.....);
chapterList.push(... chapters.map());
run = lastPage != page;
}
return chapterList;
} | ||
|
||
async _getLastPage(mangaId) { | ||
let uri = `${this.url}/load-more-chapters${mangaId}?page=1`; |
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.
useless
|
||
async _getPages(chapter) { | ||
try { | ||
// Verilen chapterUrl'den HTML i�eri�ini al�r |
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.
do not use fetch directly. We have this.fetdhDOM for that
Moreover, what are you doing?
chapter.id, like manga.id are NEVER supposed to be full flegged url.
We only save relative paths, or when the website allows it, the identifier used in the own website api.
If you try to await fetch(chapter.id);
i dont see how its supposed to work.
At least, if you save chapter PATH as chapter.id (something like /manga/mymanga/chapterXX" you should create a real url using new URL() and this.url.
} | ||
} | ||
|
||
// async i�levi fetchMangaPages bir s�n�f y�ntemi olmal�d�r |
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.
If you really want to comment, dont do it in turkish. No offense but it wont really help in that case.
} | ||
|
||
// async i�levi fetchMangaPages bir s�n�f y�ntemi olmal�d�r | ||
async fetchMangaPages(manga) { |
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.
whats the purpose of this function?
|
||
while (hasMorePages) { | ||
let request = new Request(`${this.url}/manga?page=${page}`, this.requestOptions); | ||
let data = await this.fetchDOM(request, 'div.manga-card h5 a'); // CSS se�icisini �zelle�tirir |
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.
we really dont need comment for trivial things :)
let request = new Request(`${this.url}/manga?page=${page}`, this.requestOptions); | ||
let data = await this.fetchDOM(request, 'div.manga-card h5 a'); // CSS se�icisini �zelle�tirir | ||
|
||
if (data.length > 0) { |
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 for that. Map will just do nothing after in case its empty.
// CSS se�iciyi kullanarak t�m resim elementlerini se�me | ||
const imgElements = doc.querySelectorAll('div.image-wrapper img'); | ||
|
||
// Resim URL'leri bir diziye d�n���r |
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 comments obvious things
Suggestion to close PR after Friday, 29 November 2024 (12 weeks) if not approved by a reviewer. |
No description provided.