Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tsupkasa
Copy link

@tsupkasa tsupkasa commented Sep 5, 2024

No description provided.

Copy link
Contributor

@MikeZeDev MikeZeDev left a 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 = [];
Copy link
Contributor

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/', '');
Copy link
Contributor

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);

Copy link
Contributor

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`;
Copy link
Contributor

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
Copy link
Contributor

@MikeZeDev MikeZeDev Sep 6, 2024

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
Copy link
Contributor

@MikeZeDev MikeZeDev Sep 6, 2024

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) {
Copy link
Contributor

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
Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

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

@ronny1982
Copy link
Contributor

Suggestion to close PR after Friday, 29 November 2024 (12 weeks) if not approved by a reviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants