Add MangaFast (#3638)

* Add MangaFast

* Address issue #1

* Address Issue #2

* Update build.gradle

* restructure

* Update MangaFast.kt

* Update MangaFast.kt

Co-authored-by: snakedoc83 <mikepeterson83@gmail.com>
This commit is contained in:
AbdullahM0hamed 2020-06-29 02:16:49 +01:00 committed by GitHub
parent d8b2c0c368
commit a06f195081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'MangaFast'
pkgNameSuffix = 'en.mangafast'
extClass = '.MangaFast'
extVersionCode = 1
libVersion = '1.2'
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,91 @@
package eu.kanade.tachiyomi.extension.en.mangafast
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.util.Locale
import java.text.SimpleDateFormat
class MangaFast: ParsedHttpSource() {
override val name = "MangaFast"
override val baseUrl = "https://mangafast.net"
override val lang = "en"
override val supportsLatest = true
override fun popularMangaRequest(page: Int) = GET("$baseUrl/list-manga/", headers)
override fun popularMangaSelector() = "li.ranking1"
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.select("a").attr("href"))
title = element.select("h4").text().trim()
thumbnail_url = element.select("img").attr("abs:data-src").substringBeforeLast("resize")
}
override fun popularMangaNextPageSelector(): String? = null
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/read/page/$page", headers)
override fun latestUpdatesSelector() = "div.ls5"
override fun latestUpdatesFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.select("a").attr("href"))
title = element.select("h3").text().trim()
thumbnail_url = element.select("img").attr("abs:data-src")
}
override fun latestUpdatesNextPageSelector() = "a.next"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = GET("$baseUrl/page/$page/?s=$query", headers)
override fun searchMangaSelector() = latestUpdatesSelector()
override fun searchMangaFromElement(element: Element) = latestUpdatesFromElement(element)
override fun searchMangaNextPageSelector() = latestUpdatesNextPageSelector()
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
author = document.select("td[itemprop=creator]").text().trim()
status = parseStatus(document.select(".inftable").text())
genre = document.select("a[itemprop=genre]").joinToString { it.text() }
description = document.select("[itemprop=description]").first().text().trim()
}
private fun parseStatus(status: String) = when {
status.contains("Ongoing") -> SManga.ONGOING
status.contains("Completed") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
override fun chapterListSelector() = "tr:has(td.tgs)"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
setUrlWithoutDomain(element.select("a").attr("href"))
name = element.select("a").attr("title")
date_upload = dateFormat.parse(element.select("td.tgs").text().trim())?.time ?: 0
}
companion object {
val dateFormat by lazy {
SimpleDateFormat("yyyy-MM-dd", Locale.US)
}
}
override fun pageListParse(document: Document): List<Page> {
return document.select("div.chp2 > img").mapIndexed { i, element ->
Page(i, "", element.attr("abs:src"))
}
}
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not Used")
override fun getFilterList() = FilterList()
}