Fix TMO / Lector (#2189)
* Update build.gradle * Update build.gradle * Update TMO * Update LectorManga.kt * Change Date / Time * Update TuMangaOnline.kt * Update date format * Update LectorManga.kt * Update Time * Update Time * Clean up TMO time code * Clean up Lector time code * Fix url * Update URL * Update userAgent Version * Update userAgent Version
This commit is contained in:
parent
a649c171c6
commit
98ff250c7c
@ -5,7 +5,7 @@ ext {
|
|||||||
appName = 'Tachiyomi: LectorManga'
|
appName = 'Tachiyomi: LectorManga'
|
||||||
pkgNameSuffix = 'es.lectormanga'
|
pkgNameSuffix = 'es.lectormanga'
|
||||||
extClass = '.LectorManga'
|
extClass = '.LectorManga'
|
||||||
extVersionCode = 6
|
extVersionCode = 7
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
.build()!!
|
.build()!!
|
||||||
|
|
||||||
private val userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
|
private val userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
|
||||||
|
|
||||||
override fun headersBuilder(): Headers.Builder {
|
override fun headersBuilder(): Headers.Builder {
|
||||||
return Headers.Builder()
|
return Headers.Builder()
|
||||||
@ -187,15 +187,12 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||||||
|
|
||||||
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
||||||
|
|
||||||
private val scriptselector = "disqus_config"
|
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
time1 = SimpleDateFormat("yyyy-M-d k:m:s", Locale.US).format(Date()) //Emulate when the chapter page is opened
|
time = serverTime() //Get time when the chapter page is opened
|
||||||
|
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val chapterurl = response.request().url().toString()
|
val chapterurl = response.request().url().toString()
|
||||||
val script = document.select("script:containsData($scriptselector)").html()
|
val chapteridselector = ""
|
||||||
val chapteridselector = script.substringAfter("getAttribute(\"").substringBefore("\"")
|
|
||||||
|
|
||||||
// One-shot
|
// One-shot
|
||||||
if (document.select("#chapters").isEmpty()) {
|
if (document.select("#chapters").isEmpty()) {
|
||||||
@ -242,16 +239,21 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(date: String): Long = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(date).time
|
private fun parseChapterDate(date: String): Long = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(date).time
|
||||||
private var time1 = SimpleDateFormat("yyyy-M-d k:m:s", Locale.US).format(Date()) //Grab time at app launch, can be updated
|
private var time = serverTime() //Grab time at app launch, can be updated
|
||||||
|
private fun serverTime() :String {
|
||||||
|
val formatter = SimpleDateFormat("yyyy-MM-dd kk:mm:ss", Locale.US)
|
||||||
|
formatter.timeZone = TimeZone.getTimeZone("GMT+1") //Convert time to match server
|
||||||
|
return formatter.format(Date())
|
||||||
|
}
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
val (chapterURL, chapterID) = chapter.url.split("#")
|
val (chapterURL, chapterID) = chapter.url.split("#")
|
||||||
val response = client.newCall(GET(chapterURL, headers)).execute() //Get chapter page for current token
|
val response = client.newCall(GET(chapterURL, headers)).execute() //Get chapter page for current token
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val geturl = document.select("form#$chapterID").attr("action") //Get redirect URL
|
val geturl = document.select("form#$chapterID").attr("action")+"/$time" //Get redirect URL
|
||||||
val token = document.select("form#$chapterID input").attr("value") //Get token
|
val token = document.select("form#$chapterID input").attr("value") //Get token
|
||||||
val method = document.select("form#$chapterID").attr("method") //Check POST or GET
|
val method = document.select("form#$chapterID").attr("method") //Check POST or GET
|
||||||
val time2 = SimpleDateFormat("yyyy-M-d k:m:s", Locale.US).format(Date()) //Get time of chapter request
|
time = serverTime() //Update time for next chapter
|
||||||
|
|
||||||
val getHeaders = headersBuilder()
|
val getHeaders = headersBuilder()
|
||||||
.add("User-Agent", userAgent)
|
.add("User-Agent", userAgent)
|
||||||
@ -263,8 +265,6 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||||||
"GET" -> null
|
"GET" -> null
|
||||||
"POST" -> FormBody.Builder()
|
"POST" -> FormBody.Builder()
|
||||||
.add("_token", token)
|
.add("_token", token)
|
||||||
.add("time", time1)
|
|
||||||
.add("time2", time2)
|
|
||||||
.build()
|
.build()
|
||||||
else -> throw UnsupportedOperationException("Unknown method. Open GitHub issue")
|
else -> throw UnsupportedOperationException("Unknown method. Open GitHub issue")
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ ext {
|
|||||||
appName = 'Tachiyomi: TuMangaOnline'
|
appName = 'Tachiyomi: TuMangaOnline'
|
||||||
pkgNameSuffix = 'es.tumangaonline'
|
pkgNameSuffix = 'es.tumangaonline'
|
||||||
extClass = '.TuMangaOnline'
|
extClass = '.TuMangaOnline'
|
||||||
extVersionCode = 22
|
extVersionCode = 23
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
.build()!!
|
.build()!!
|
||||||
|
|
||||||
private val userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" //last updated 2020/01/06
|
private val userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" //last updated 2020/02/04
|
||||||
|
|
||||||
override fun headersBuilder(): Headers.Builder {
|
override fun headersBuilder(): Headers.Builder {
|
||||||
return Headers.Builder()
|
return Headers.Builder()
|
||||||
@ -198,16 +198,12 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||||||
|
|
||||||
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
||||||
|
|
||||||
private val scriptselector = "addEventListener"
|
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
time1 = SimpleDateFormat("yyyy-M-d k:m:s", Locale.US).format(Date()) //Emulate when the chapter pate is opened
|
time = serverTime() //Get time when the chapter page is opened
|
||||||
|
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val chapterurl = response.request().url().toString()
|
val chapterurl = response.request().url().toString()
|
||||||
val script = document.select("script:containsData($scriptselector)").html()
|
val chapteridselector = ""
|
||||||
val chapteridselector = script.substringAfter("getAttribute(\"").substringBefore("\"")
|
|
||||||
|
|
||||||
// One-shot
|
// One-shot
|
||||||
if (document.select("div.chapters").isEmpty()) {
|
if (document.select("div.chapters").isEmpty()) {
|
||||||
return document.select(oneShotChapterListSelector()).map { oneShotChapterFromElement(it, chapterurl, chapteridselector) }
|
return document.select(oneShotChapterListSelector()).map { oneShotChapterFromElement(it, chapterurl, chapteridselector) }
|
||||||
@ -253,16 +249,21 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(date: String): Long = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(date).time
|
private fun parseChapterDate(date: String): Long = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(date).time
|
||||||
private var time1 = SimpleDateFormat("yyyy-M-d k:m:s", Locale.US).format(Date()) //Grab time at app launch, can be updated
|
private var time = serverTime() //Grab time at app launch, can be updated
|
||||||
|
private fun serverTime() :String {
|
||||||
|
val formatter = SimpleDateFormat("yyyy-MM-dd kk:mm:ss", Locale.US)
|
||||||
|
formatter.timeZone = TimeZone.getTimeZone("GMT+1") //Convert time to match server
|
||||||
|
return formatter.format(Date())
|
||||||
|
}
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
val (chapterURL, chapterID) = chapter.url.split("#")
|
val (chapterURL, chapterID) = chapter.url.split("#")
|
||||||
val response = client.newCall(GET(chapterURL, headers)).execute() //Get chapter page for current token
|
val response = client.newCall(GET(chapterURL, headers)).execute() //Get chapter page for current token
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val geturl = document.select("form#$chapterID").attr("action") //Get redirect URL
|
val geturl = document.select("form#$chapterID").attr("action")+"/$time" //Get redirect URL
|
||||||
val token = document.select("form#$chapterID input").attr("value") //Get token
|
val token = document.select("form#$chapterID input").attr("value") //Get token
|
||||||
val method = document.select("form#$chapterID").attr("method") //Check POST or GET
|
val method = document.select("form#$chapterID").attr("method") //Check POST or GET
|
||||||
val time2 = SimpleDateFormat("yyyy-M-d k:m:s", Locale.US).format(Date()) //Get time of chapter request
|
time = serverTime() //Update time for next chapter
|
||||||
|
|
||||||
val getHeaders = headersBuilder()
|
val getHeaders = headersBuilder()
|
||||||
.add("User-Agent", userAgent)
|
.add("User-Agent", userAgent)
|
||||||
@ -274,8 +275,6 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||||||
"GET" -> null
|
"GET" -> null
|
||||||
"POST" -> FormBody.Builder()
|
"POST" -> FormBody.Builder()
|
||||||
.add("_token", token)
|
.add("_token", token)
|
||||||
.add("time", time1)
|
|
||||||
.add("time2", time2)
|
|
||||||
.build()
|
.build()
|
||||||
else -> throw UnsupportedOperationException("Unknown method. Open GitHub issue")
|
else -> throw UnsupportedOperationException("Unknown method. Open GitHub issue")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user