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

Add HotManga source. #6992

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ProgrammingForFun2021
Copy link

@ProgrammingForFun2021 ProgrammingForFun2021 commented Jan 5, 2025

Checklist:

  • Updated extVersionCode value in build.gradle for individual extensions
  • Updated overrideVersionCode or baseVersionCode as needed for all multisrc extensions
  • Referenced all related issues in the PR body (e.g. "Closes #xyz")
  • Added the isNsfw = true flag in build.gradle when appropriate
  • Have not changed source names
  • Have explicitly kept the id if a source's name or language were changed
  • Have tested the modifications by compiling and running the extension through Android Studio
  • Have removed web_hi_res_512.png when adding a new extension

import kotlinx.serialization.Serializable

@Serializable
data class MangaDto(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data class MangaDto(
class MangaDto(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also remove unused fields


class HotManga : ConfigurableSource, HttpSource() {

override val id = 2073023199372375753
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set this explicitly?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extension won't working if it's not specified.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would if you don't access the preference during class initialization, (namely for baseurl)

.writeTimeout(15, TimeUnit.SECONDS).build()

override fun headersBuilder() = super.headersBuilder()
.set("Referer", baseUrl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referer header has a trailing slash.

Suggested change
.set("Referer", baseUrl)
.set("Referer", "$baseUrl/")

Comment on lines 93 to 94
val url = "${baseUrl}$apiString".toHttpUrl().newBuilder()
return GET(url.build(), headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just pass a string to GET()

return GET(url.build(), headers)
}

override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using the fetch* methods.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which method I should use instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the functions used in the parent fetch* methods, if the site structure allows it. So:

  • Instead of fetchPopularManga, you should use popularMangaRequest and popularMangaParse
  • Instead of fetchSearchManga, you should use searchMangaRequest and searchMangaParse
  • Instead of fetchLatestUpdates, you should use latestUpdatesRequest and latestUpdatesParse
  • Instead of fetchMangaDetails, you should use mangaDetailsRequest and mangaDetailsParse
  • Instead of fetchChapterList, you should use chapterListRequest and chapterListParse
  • Instead of fetchPageList, you should use pageListRequest and pageListParse
  • Instead of fetchImageUrl, you should use imageUrlRequest and imageUrlParse

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks. I'll rework it...

chapterName += paidSymbol
}
val sChapter = SChapter.create().apply {
url = chapterUrl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use setUrlWithoutDomain() to allow for easier domain swapping in the future.

@ProgrammingForFun2021 ProgrammingForFun2021 marked this pull request as draft January 6, 2025 16:27
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