Fix duplicate images at WpMangaStream sources (#7432)

* Fix duplicate images on Wpmangastream sources.

* Add Accept header.
This commit is contained in:
Alessandro Jean 2021-06-04 08:39:46 -03:00 committed by GitHub
parent 884310606e
commit cf9ed00c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -285,7 +285,7 @@ abstract class WPMangaStream(
htmlPages += scriptPages htmlPages += scriptPages
} }
return htmlPages return htmlPages.distinctBy { it.imageUrl }
} }
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
@ -293,13 +293,14 @@ abstract class WPMangaStream(
override fun imageRequest(page: Page): Request { override fun imageRequest(page: Page): Request {
val headers = Headers.Builder() val headers = Headers.Builder()
headers.apply { headers.apply {
add("Accept", "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8")
add("Referer", baseUrl) add("Referer", baseUrl)
add("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.100 Mobile Safari/537.36") add("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.100 Mobile Safari/537.36")
} }
if (page.imageUrl!!.contains(".wp.com")) { if (page.imageUrl!!.contains(".wp.com")) {
headers.apply { headers.apply {
add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3") set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3")
} }
} }

View File

@ -9,7 +9,7 @@ class WPMangaStreamGenerator : ThemeSourceGenerator {
override val themeClass = "WPMangaStream" override val themeClass = "WPMangaStream"
override val baseVersionCode: Int = 5 override val baseVersionCode: Int = 6
override val sources = listOf( override val sources = listOf(
SingleLang("Asura Scans", "https://www.asurascans.com", "en", overrideVersionCode = 1), SingleLang("Asura Scans", "https://www.asurascans.com", "en", overrideVersionCode = 1),