Add shqqaa.com (#1568)

* Add shqqaa.com

Signed-off-by: yshalsager <ysh-alsager@hotmail.com>

* ar: shqqaa: Return an empty observable on search

Signed-off-by: yshalsager <ysh-alsager@hotmail.com>
This commit is contained in:
Youssif Shaaban Alsager 2019-09-30 16:24:25 +02:00 committed by arkon
parent b054d22bb6
commit 92a35370cf
8 changed files with 132 additions and 0 deletions

View File

@ -0,0 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
appName = 'Tachiyomi: Shqqaa Manga'
pkgNameSuffix = 'ar.shqqaa'
extClass = '.Shqqaa'
extVersionCode = 1
libVersion = '1.2'
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

View File

@ -0,0 +1,120 @@
package eu.kanade.tachiyomi.extension.ar.shqqaa
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import rx.Observable
class Shqqaa : ParsedHttpSource() {
override val name = "مانجا شقاع"
override val baseUrl = "https://www.shqqaa.com"
override val lang = "ar"
override val supportsLatest = true
override val client: OkHttpClient = network.cloudflareClient
// Popular
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/manga", headers)
}
override fun popularMangaSelector() = "div.card"
override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create()
manga.thumbnail_url = element.select("img").first().attr("data-src")
element.select("a").first().let {
manga.setUrlWithoutDomain(it.attr("href"))
manga.title = it.attr("title").split(", ")[0]
}
return manga
}
override fun popularMangaNextPageSelector(): String? = null
// Latest
override fun latestUpdatesRequest(page: Int): Request {
return GET("$baseUrl/manga/chapters/", headers)
}
override fun latestUpdatesSelector(): String = "div.row > div.col-xl-3"
override fun latestUpdatesFromElement(element: Element): SManga {
val manga = SManga.create()
element.select("a").first().let {
manga.setUrlWithoutDomain("${it.attr("href").substringBeforeLast('/')}/")
manga.title = element.select("small").first().text().split(", ")[0]
}
manga.thumbnail_url = element.select("img").first().attr("data-src")
return manga
}
override fun latestUpdatesNextPageSelector(): String? = null
// Search
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> = Observable.empty()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Not used")
override fun searchMangaSelector(): String = throw Exception("Not Used")
override fun searchMangaFromElement(element: Element): SManga = throw Exception("Not Used")
override fun searchMangaNextPageSelector() = throw Exception("Not Used")
// Manga summary page
override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div.col-sm-12")
val mangaInfo = infoElement[1]
val manga = SManga.create()
manga.title = mangaInfo.select("small.text-muted")[1].ownText().split(", ")[0]
manga.author = null
val status = mangaInfo.select("span.badge").first().ownText()
manga.status = parseStatus(status)
manga.genre = null
manga.description = infoElement.first().select(".text-muted").first().ownText()
manga.thumbnail_url = mangaInfo.select("img").attr("data-src")
return manga
}
private fun parseStatus(status: String?) = when {
status == null -> SManga.UNKNOWN
status.contains("مستمر") -> SManga.ONGOING
status.contains("منتهي") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
// Chapters
override fun chapterListSelector() = "a.m-1"
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
element.select("a").let {
chapter.setUrlWithoutDomain(it.attr("href"))
chapter.name = it.text()
}
chapter.date_upload = 0
return chapter
}
// Pages
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
document.select("div.img-manga img").forEach {
pages.add(Page(pages.size, "", it.attr("src")))
}
return pages
}
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
override fun getFilterList() = FilterList()
}