Add Xinmeitulu (#11956)
* Add Xinmei tulu * Xinmeitulu: cleanup Co-authored-by: jopejoe1 <34899572+jopejoe1@users.noreply.github.com>
This commit is contained in:
parent
fbe4571aa1
commit
e88c2d2f14
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="eu.kanade.tachiyomi.extension">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".all.xinmeitulu.XinmeituluUrlActivity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data android:host="*.xinmeitulu.com" />
|
||||||
|
<data android:host="xinmeitulu.com" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:pathPattern="/photo/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -0,0 +1,12 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
|
ext {
|
||||||
|
extName = 'Xinmeitulu'
|
||||||
|
pkgNameSuffix = 'all.xinmeitulu'
|
||||||
|
extClass = '.Xinmeitulu'
|
||||||
|
extVersionCode = 1
|
||||||
|
isNsfw = true
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "$rootDir/common.gradle"
|
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
|
@ -0,0 +1,82 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.all.xinmeitulu
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
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 eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
import rx.Observable
|
||||||
|
|
||||||
|
class Xinmeitulu : ParsedHttpSource() {
|
||||||
|
override val baseUrl = "https://www.xinmeitulu.com"
|
||||||
|
override val lang = "all"
|
||||||
|
override val name = "Xinmeitulu"
|
||||||
|
override val supportsLatest = false
|
||||||
|
|
||||||
|
// Latest
|
||||||
|
|
||||||
|
override fun latestUpdatesRequest(page: Int) = throw UnsupportedOperationException("Not Used.")
|
||||||
|
override fun latestUpdatesNextPageSelector() = throw UnsupportedOperationException("Not Used.")
|
||||||
|
override fun latestUpdatesSelector() = throw UnsupportedOperationException("Not Used.")
|
||||||
|
override fun latestUpdatesFromElement(element: Element) = throw UnsupportedOperationException("Not Used.")
|
||||||
|
|
||||||
|
// Popular
|
||||||
|
|
||||||
|
override fun popularMangaRequest(page: Int) = GET("$baseUrl/page/$page")
|
||||||
|
override fun popularMangaNextPageSelector() = ".next"
|
||||||
|
override fun popularMangaSelector() = ".container > .row > div"
|
||||||
|
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
|
||||||
|
setUrlWithoutDomain(element.select("figure > a").attr("abs:href"))
|
||||||
|
title = element.select("figcaption").text()
|
||||||
|
thumbnail_url = element.select("img").attr("abs:data-original-")
|
||||||
|
genre = element.select("a.tag").joinToString(", ") { it.text() }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search
|
||||||
|
|
||||||
|
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
|
||||||
|
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
||||||
|
override fun searchMangaSelector() = popularMangaSelector()
|
||||||
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) =
|
||||||
|
GET("$baseUrl/page/$page?s=$query", headers)
|
||||||
|
|
||||||
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
|
return if (query.startsWith("SLUG:")) {
|
||||||
|
val slug = query.removePrefix("SLUG:")
|
||||||
|
client.newCall(GET("$baseUrl/photo/$slug", headers)).asObservableSuccess()
|
||||||
|
.map { response -> MangasPage(listOf(mangaDetailsParse(response.asJsoup())), false) }
|
||||||
|
} else super.fetchSearchManga(page, query, filters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Details
|
||||||
|
|
||||||
|
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
||||||
|
setUrlWithoutDomain(document.selectFirst("link[rel=canonical]").attr("abs:href"))
|
||||||
|
title = document.select(".container > h1").text()
|
||||||
|
description = document.select(".container > *:not(div)").text()
|
||||||
|
status = SManga.COMPLETED
|
||||||
|
thumbnail_url = document.selectFirst("figure img").attr("abs:data-original")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chapters
|
||||||
|
|
||||||
|
override fun chapterListSelector() = "html"
|
||||||
|
|
||||||
|
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||||
|
setUrlWithoutDomain(element.selectFirst("link[rel=canonical]").attr("abs:href"))
|
||||||
|
name = element.select(".container > h1").text()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun pageListParse(document: Document) =
|
||||||
|
document.select(".container > div > figure img").mapIndexed { index, element ->
|
||||||
|
Page(index, imageUrl = element.attr("abs:data-original"))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.all.xinmeitulu
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.ActivityNotFoundException
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
class XinmeituluUrlActivity : Activity() {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val host = intent?.data?.host
|
||||||
|
val pathSegments = intent?.data?.pathSegments
|
||||||
|
|
||||||
|
if (host != null && pathSegments != null) {
|
||||||
|
val query = fromUrl(pathSegments)
|
||||||
|
|
||||||
|
if (query == null) {
|
||||||
|
Log.e("XinmeiTuluUrlActivity", "Unable to parse URI from intent $intent")
|
||||||
|
finish()
|
||||||
|
exitProcess(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
val mainIntent = Intent().apply {
|
||||||
|
action = "eu.kanade.tachiyomi.SEARCH"
|
||||||
|
putExtra("query", query)
|
||||||
|
putExtra("filter", packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
startActivity(mainIntent)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
Log.e("XinmeiTuluUrlActivity", e.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finish()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fromUrl(pathSegments: MutableList<String>): String? {
|
||||||
|
return if (pathSegments.size >= 2) {
|
||||||
|
val slug = pathSegments[1]
|
||||||
|
"SLUG:$slug"
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue