-
Notifications
You must be signed in to change notification settings - Fork 542
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
base: main
Are you sure you want to change the base?
Add HotManga source. #6992
Conversation
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MangaDto( |
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.
data class MangaDto( | |
class MangaDto( |
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.
also remove unused fields
|
||
class HotManga : ConfigurableSource, HttpSource() { | ||
|
||
override val id = 2073023199372375753 |
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.
Why set this explicitly?
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.
The extension won't working if it's not specified.
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.
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) |
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.
Referer header has a trailing slash.
.set("Referer", baseUrl) | |
.set("Referer", "$baseUrl/") |
val url = "${baseUrl}$apiString".toHttpUrl().newBuilder() | ||
return GET(url.build(), headers) |
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.
You can just pass a string to GET()
src/ru/hotmanga/src/eu/kanade/tachiyomi/extension/ru/hotmanga/HotManga.kt
Outdated
Show resolved
Hide resolved
src/ru/hotmanga/src/eu/kanade/tachiyomi/extension/ru/hotmanga/HotManga.kt
Outdated
Show resolved
Hide resolved
return GET(url.build(), headers) | ||
} | ||
|
||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> { |
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.
Avoid using the fetch*
methods.
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.
Which method I should use instead?
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.
You should use the functions used in the parent fetch*
methods, if the site structure allows it. So:
- Instead of
fetchPopularManga
, you should usepopularMangaRequest
andpopularMangaParse
- Instead of
fetchSearchManga
, you should usesearchMangaRequest
andsearchMangaParse
- Instead of
fetchLatestUpdates
, you should uselatestUpdatesRequest
andlatestUpdatesParse
- Instead of
fetchMangaDetails
, you should usemangaDetailsRequest
andmangaDetailsParse
- Instead of
fetchChapterList
, you should usechapterListRequest
andchapterListParse
- Instead of
fetchPageList
, you should usepageListRequest
andpageListParse
- Instead of
fetchImageUrl
, you should useimageUrlRequest
andimageUrlParse
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.
Ok, thanks. I'll rework it...
chapterName += paidSymbol | ||
} | ||
val sChapter = SChapter.create().apply { | ||
url = chapterUrl |
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 setUrlWithoutDomain()
to allow for easier domain swapping in the future.
Checklist:
extVersionCode
value inbuild.gradle
for individual extensionsoverrideVersionCode
orbaseVersionCode
as needed for all multisrc extensionsisNsfw = true
flag inbuild.gradle
when appropriateid
if a source's name or language were changedweb_hi_res_512.png
when adding a new extension