From d07d777c2b1837112a95197278ce86736572cc6c Mon Sep 17 00:00:00 2001 From: zhongfly Date: Wed, 16 Jun 2021 23:16:02 +0800 Subject: [PATCH] [zh-dmzj] Fix url issue (#7673) * fix url issue replace dmzj1.com with dmzj.com fix #7668 * bump version --- src/zh/dmzj/build.gradle | 2 +- .../tachiyomi/extension/zh/dmzj/Dmzj.kt | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/zh/dmzj/build.gradle b/src/zh/dmzj/build.gradle index edd059ecd..15dfe0d7a 100644 --- a/src/zh/dmzj/build.gradle +++ b/src/zh/dmzj/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Dmzj' pkgNameSuffix = 'zh.dmzj' extClass = '.Dmzj' - extVersionCode = 19 + extVersionCode = 20 libVersion = '1.2' } diff --git a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt index ccb45d83a..0ffddb4ff 100644 --- a/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt +++ b/src/zh/dmzj/src/eu/kanade/tachiyomi/extension/zh/dmzj/Dmzj.kt @@ -44,15 +44,15 @@ class Dmzj : ConfigurableSource, HttpSource() { override val lang = "zh" override val supportsLatest = true override val name = "动漫之家" - override val baseUrl = "https://m.dmzj1.com" - private val v3apiUrl = "https://v3api.dmzj1.com" - private val v3ChapterApiUrl = "https://nnv3api.dmzj1.com" + override val baseUrl = "https://m.dmzj.com" + private val v3apiUrl = "https://v3api.dmzj.com" + private val v3ChapterApiUrl = "https://nnv3api.dmzj.com" // v3api now shutdown the functionality to fetch manga detail and chapter list, so move these logic to v4api - private val v4apiUrl = "https://nnv4api.dmzj1.com" // https://v4api.dmzj1.com + private val v4apiUrl = "https://nnv4api.dmzj.com" // https://v4api.dmzj.com private val apiUrl = "https://api.dmzj.com" - private val oldPageListApiUrl = "https://api.m.dmzj1.com" - private val webviewPageListApiUrl = "https://m.dmzj1.com/chapinfo" - private val imageCDNUrl = "https://images.dmzj1.com" + private val oldPageListApiUrl = "https://api.m.dmzj.com" + private val webviewPageListApiUrl = "https://m.dmzj.com/chapinfo" + private val imageCDNUrl = "https://images.dmzj.com" private fun cleanUrl(url: String) = if (url.startsWith("//")) "https:$url" @@ -87,7 +87,7 @@ class Dmzj : ConfigurableSource, HttpSource() { .build() override fun headersBuilder() = Headers.Builder().apply { - set("Referer", "https://www.dmzj1.com/") + set("Referer", "https://www.dmzj.com/") set( "User-Agent", "Mozilla/5.0 (Linux; Android 10) " + @@ -203,7 +203,7 @@ class Dmzj : ConfigurableSource, HttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { if (query != "") { - val uri = Uri.parse("http://s.acg.dmzj1.com/comicsum/search.php").buildUpon() + val uri = Uri.parse("http://s.acg.dmzj.com/comicsum/search.php").buildUpon() uri.appendQueryParameter("s", query) return GET(uri.toString()) } else { @@ -365,7 +365,7 @@ class Dmzj : ConfigurableSource, HttpSource() { val response = client.newCall(GET("$webviewPageListApiUrl/${chapter.url}.html", headers)).execute() Observable.just(pageListParse(response)) } catch (e: Exception) { - // api.m.dmzj1.com + // api.m.dmzj.com val response = client.newCall(GET("$oldPageListApiUrl/comic/chapter/${chapter.url}.html", headers)).execute() Observable.just(pageListParse(response)) } catch (e: Exception) { @@ -396,7 +396,7 @@ class Dmzj : ConfigurableSource, HttpSource() { val obj = JSONObject(responseBody) obj.getJSONObject("chapter").getJSONArray("page_url") } catch (e: org.json.JSONException) { - // JSON data from api.m.dmzj1.com may be incomplete, extract page_url list using regex + // JSON data from api.m.dmzj.com may be incomplete, extract page_url list using regex val extractPageList = extractPageListRegex.find(responseBody)!!.value JSONObject("{$extractPageList}").getJSONArray("page_url") } @@ -405,10 +405,10 @@ class Dmzj : ConfigurableSource, HttpSource() { } val ret = ArrayList(arr.length()) for (i in 0 until arr.length()) { - // Seems image urls from webpage api and api.m.dmzj1.com may be URL encoded multiple times + // Seems image urls from webpage api and api.m.dmzj.com may be URL encoded multiple times val url = URLDecoder.decode(URLDecoder.decode(arr.getString(i), "UTF-8"), "UTF-8") .replace("http:", "https:") - .replace("dmzj.com", "dmzj1.com") + .replace("dmzj1.com", "dmzj.com") ret.add(Page(i, "", url)) } return ret