Fix: extract date from episode text (14.04.2026 클라이맥스 10화), rollback spinner timeout
This commit is contained in:
@@ -444,7 +444,28 @@ class TvmonScraper {
|
||||
.replace("NEW", "")
|
||||
.trim()
|
||||
|
||||
val episodeNumMatch = Pattern.compile("(\\d+)\\s*화|(\\d+)\\s*회|EP\\.?(\\d+)|제\\s*(\\d+)\\s*부").matcher(linkText)
|
||||
val datePattern = Pattern.compile("^(\\d{2})[./](\\d{2})[./](\\d{2,4})\\s+(.+)$|^(\\d{2})[./](\\d{2})[./](\\d{2,4})(.+)$")
|
||||
val dateMatch = datePattern.matcher(linkText)
|
||||
var dateStr = ""
|
||||
var titleStr = cleanLinkText
|
||||
|
||||
if (dateMatch.find()) {
|
||||
val day = dateMatch.group(1) ?: dateMatch.group(5)
|
||||
val month = dateMatch.group(2) ?: dateMatch.group(6)
|
||||
val year = dateMatch.group(3) ?: dateMatch.group(7)
|
||||
val titlePart = dateMatch.group(4) ?: dateMatch.group(8)
|
||||
|
||||
if (day != null && month != null && year != null) {
|
||||
dateStr = if (year.length == 2) {
|
||||
"20$year/$month/$day"
|
||||
} else {
|
||||
"$year/$month/$day"
|
||||
}
|
||||
titleStr = titlePart?.trim() ?: cleanLinkText
|
||||
}
|
||||
}
|
||||
|
||||
val episodeNumMatch = Pattern.compile("(\\d+)\\s*화|(\\d+)\\s*회|EP\\.?(\\d+)|제\\s*(\\d+)\\s*부").matcher(titleStr)
|
||||
val episodeTitle = if (episodeNumMatch.find()) {
|
||||
episodeNumMatch.group(1) ?: episodeNumMatch.group(2) ?: episodeNumMatch.group(3) ?: episodeNumMatch.group(4)
|
||||
} else {
|
||||
@@ -457,26 +478,9 @@ class TvmonScraper {
|
||||
episodeIndex++.toString()
|
||||
}
|
||||
|
||||
val dateEl = link.parent()?.parent()?.selectFirst("td, div, span")
|
||||
var dateStr = ""
|
||||
if (dateEl != null) {
|
||||
val dateText = dateEl.text().trim()
|
||||
val dateMatch = Pattern.compile("(\\d{2})[./](\\d{2})[./](\\d{2,4})").matcher(dateText)
|
||||
if (dateMatch.find()) {
|
||||
val day = dateMatch.group(1)
|
||||
val month = dateMatch.group(2)
|
||||
val year = dateMatch.group(3)
|
||||
dateStr = if (year.length == 2) {
|
||||
"20$year/$month/$day"
|
||||
} else {
|
||||
"$year/$month/$day"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
episodes.add(Episode(
|
||||
number = finalNumber,
|
||||
title = cleanLinkText.ifBlank { finalNumber },
|
||||
title = titleStr.ifBlank { finalNumber },
|
||||
url = fullUrl,
|
||||
type = "webview",
|
||||
date = dateStr
|
||||
|
||||
@@ -290,17 +290,13 @@ class PlaybackActivity : AppCompatActivity() {
|
||||
|
||||
handler.postDelayed({
|
||||
injectEnhancedAutoPlayScript()
|
||||
android.util.Log.i("PlaybackActivity", "Enhanced AutoPlay script injected (first)")
|
||||
android.util.Log.i("PlaybackActivity", "Enhanced AutoPlay script injected")
|
||||
}, 800)
|
||||
|
||||
handler.postDelayed({
|
||||
injectEnhancedAutoPlayScript()
|
||||
android.util.Log.i("PlaybackActivity", "Enhanced AutoPlay script injected (second)")
|
||||
}, 2000)
|
||||
|
||||
handler.postDelayed({
|
||||
injectEnhancedAutoPlayScript()
|
||||
android.util.Log.i("PlaybackActivity", "Enhanced AutoPlay script injected (third)")
|
||||
runOnUiThread {
|
||||
loadingOverlay.visibility = View.GONE
|
||||
}
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user