Adjustments
This commit was merged in pull request #71.
This commit is contained in:
@@ -35,7 +35,7 @@ import org.koitharu.kotatsu.R
|
|||||||
*/
|
*/
|
||||||
class FadingSnackbar @JvmOverloads constructor(
|
class FadingSnackbar @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
attrs: AttributeSet,
|
attrs: AttributeSet? = null,
|
||||||
defStyleAttr: Int = 0
|
defStyleAttr: Int = 0
|
||||||
) : FrameLayout(context, attrs, defStyleAttr) {
|
) : FrameLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ data class MangaChapter(
|
|||||||
val number: Int,
|
val number: Int,
|
||||||
val url: String,
|
val url: String,
|
||||||
val scanlator: String? = null,
|
val scanlator: String? = null,
|
||||||
val date_upload: Long,
|
val uploadDate: Long,
|
||||||
val branch: String? = null,
|
val branch: String? = null,
|
||||||
val source: MangaSource
|
val source: MangaSource
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
@@ -87,7 +87,7 @@ class AnibelRepository(loaderContext: MangaLoaderContext) : RemoteMangaRepositor
|
|||||||
name = "Глава " + a.selectFirst("a")?.text().orEmpty(),
|
name = "Глава " + a.selectFirst("a")?.text().orEmpty(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
date_upload = 0L,
|
uploadDate = 0L,
|
||||||
source = source
|
source = source
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,10 +84,10 @@ abstract class ChanRepository(loaderContext: MangaLoaderContext) : RemoteMangaRe
|
|||||||
val href = tr?.selectFirst("a")?.relUrl("href") ?: return@mapIndexedNotNull null
|
val href = tr?.selectFirst("a")?.relUrl("href") ?: return@mapIndexedNotNull null
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = tr.select("a").text().trim(),
|
name = tr.selectFirst("a")?.text().orEmpty(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
date_upload = parseChapterDate(tr.select("div.date").text()),
|
uploadDate = parseChapterDate(tr.selectFirst("div.date")?.text().orEmpty()),
|
||||||
source = source
|
source = source
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -156,16 +156,7 @@ abstract class ChanRepository(loaderContext: MangaLoaderContext) : RemoteMangaRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(string: String): Long {
|
private fun parseChapterDate(string: String): Long {
|
||||||
return try {
|
return SimpleDateFormat("yyyy-MM-dd", Locale.US).tryParse(string)
|
||||||
dateFormat.parse(string)?.time ?: 0
|
|
||||||
} catch (_: ParseException) {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val dateFormat by lazy {
|
|
||||||
SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ class DesuMeRepository(loaderContext: MangaLoaderContext) : RemoteMangaRepositor
|
|||||||
id = generateUid(chid),
|
id = generateUid(chid),
|
||||||
source = manga.source,
|
source = manga.source,
|
||||||
url = "$baseChapterUrl$chid",
|
url = "$baseChapterUrl$chid",
|
||||||
date_upload = it.getLong("date") * 1000,
|
uploadDate = it.getLong("date") * 1000,
|
||||||
name = if (title.isEmpty()) volChap else "$volChap: $title",
|
name = if (title.isEmpty()) volChap else "$volChap: $title",
|
||||||
number = totalChapters - i
|
number = totalChapters - i
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class ExHentaiRepository(
|
|||||||
name = "${manga.title} #$i",
|
name = "${manga.title} #$i",
|
||||||
number = i,
|
number = i,
|
||||||
url = url,
|
url = url,
|
||||||
date_upload = 0L,
|
uploadDate = 0L,
|
||||||
source = source,
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,21 +124,22 @@ abstract class GroupleRepository(loaderContext: MangaLoaderContext) :
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
chapters = root.selectFirst("div.chapters-link")?.selectFirst("table")
|
chapters = root.selectFirst("div.chapters-link")?.selectFirst("table")
|
||||||
?.select("tr:has(td > a)")?.asReversed()?.mapIndexed { i, tr ->
|
?.select("tr:has(td > a)")?.asReversed()?.mapIndexedNotNull { i, tr ->
|
||||||
val href = tr.selectFirst("a")?.relUrl("href")
|
val a = tr.selectFirst("a") ?: return@mapIndexedNotNull null
|
||||||
|
val href = a.relUrl("href")
|
||||||
var translators = ""
|
var translators = ""
|
||||||
val translatorElement = tr.select("a").attr("title")
|
val translatorElement = a.attr("title")
|
||||||
if (!translatorElement.isNullOrBlank()) {
|
if (!translatorElement.isNullOrBlank()) {
|
||||||
translators = translatorElement
|
translators = translatorElement
|
||||||
.replace("(Переводчик),", "&")
|
.replace("(Переводчик),", "&")
|
||||||
.removeSuffix(" (Переводчик)")
|
.removeSuffix(" (Переводчик)")
|
||||||
}
|
}
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href!!),
|
id = generateUid(href),
|
||||||
name = tr.select("a").text().removePrefix(manga.title).trim(),
|
name = tr.selectFirst("a")?.text().orEmpty().removePrefix(manga.title).trim(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
date_upload = parseChapterDate(tr.select("td.d-none").text()),
|
uploadDate = parseChapterDate(tr.select("td.d-none").text()),
|
||||||
scanlator = translators,
|
scanlator = translators,
|
||||||
source = source
|
source = source
|
||||||
)
|
)
|
||||||
@@ -234,11 +235,7 @@ abstract class GroupleRepository(loaderContext: MangaLoaderContext) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(string: String): Long {
|
private fun parseChapterDate(string: String): Long {
|
||||||
return try {
|
return SimpleDateFormat("dd.MM.yy", Locale.US).tryParse(string)
|
||||||
dateFormat.parse(string)?.time ?: 0
|
|
||||||
} catch (_: ParseException) {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
@@ -248,9 +245,6 @@ abstract class GroupleRepository(loaderContext: MangaLoaderContext) :
|
|||||||
private val HEADER = Headers.Builder()
|
private val HEADER = Headers.Builder()
|
||||||
.add("User-Agent", "readmangafun")
|
.add("User-Agent", "readmangafun")
|
||||||
.build()
|
.build()
|
||||||
private val dateFormat by lazy {
|
|
||||||
SimpleDateFormat("dd.MM.yy", Locale.US)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ class HenChanRepository(loaderContext: MangaLoaderContext) : ChanRepository(load
|
|||||||
url = readLink,
|
url = readLink,
|
||||||
source = source,
|
source = source,
|
||||||
number = 1,
|
number = 1,
|
||||||
date_upload = 0L,
|
uploadDate = 0L,
|
||||||
name = manga.title
|
name = manga.title
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ open class MangaLibRepository(loaderContext: MangaLoaderContext) :
|
|||||||
url = url,
|
url = url,
|
||||||
source = source,
|
source = source,
|
||||||
number = total - i,
|
number = total - i,
|
||||||
date_upload = parseChapterDate(item.getString("chapter_created_at").substringBefore(" ")),
|
uploadDate = parseChapterDate(item.getString("chapter_created_at").substringBefore(" ")),
|
||||||
scanlator = scanlator,
|
scanlator = scanlator,
|
||||||
name = if (nameChapter.isNullOrBlank()) fullNameChapter else "$fullNameChapter - $nameChapter"
|
name = if (nameChapter.isNullOrBlank()) fullNameChapter else "$fullNameChapter - $nameChapter"
|
||||||
)
|
)
|
||||||
@@ -243,16 +243,7 @@ open class MangaLibRepository(loaderContext: MangaLoaderContext) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(string: String): Long {
|
private fun parseChapterDate(string: String): Long {
|
||||||
return try {
|
return SimpleDateFormat("yyy-MM-dd", Locale.US).tryParse(string)
|
||||||
dateFormat.parse(string)?.time ?: 0
|
|
||||||
} catch (_: ParseException) {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val dateFormat by lazy {
|
|
||||||
SimpleDateFormat("yyy-MM-dd", Locale.US)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ class MangaOwlRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposit
|
|||||||
name = a.select("label").text(),
|
name = a.select("label").text(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
date_upload = parseChapterDate(li.select("small:last-of-type").text()),
|
uploadDate = parseChapterDate(li.select("small:last-of-type").text()),
|
||||||
source = MangaSource.MANGAOWL
|
source = MangaSource.MANGAOWL
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -159,17 +159,7 @@ class MangaOwlRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposit
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(string: String): Long {
|
private fun parseChapterDate(string: String): Long {
|
||||||
return try {
|
return SimpleDateFormat("MM/dd/yyyy", Locale.US).tryParse(string)
|
||||||
dateFormat.parse(string)?.time ?: 0
|
|
||||||
} catch (_: ParseException) {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val dateFormat by lazy {
|
|
||||||
SimpleDateFormat("MM/dd/yyyy", Locale.US)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ class MangaTownRepository(loaderContext: MangaLoaderContext) :
|
|||||||
url = href,
|
url = href,
|
||||||
source = MangaSource.MANGATOWN,
|
source = MangaSource.MANGATOWN,
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
date_upload = parseChapterDate(li.select("span.time").text()),
|
uploadDate = parseChapterDate(li.selectFirst("span.time")?.text().orEmpty()),
|
||||||
name = name.ifEmpty { "${manga.title} - ${i + 1}" }
|
name = name.ifEmpty { "${manga.title} - ${i + 1}" }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -173,13 +173,7 @@ class MangaTownRepository(loaderContext: MangaLoaderContext) :
|
|||||||
return when {
|
return when {
|
||||||
date.contains("Today") -> Calendar.getInstance().timeInMillis
|
date.contains("Today") -> Calendar.getInstance().timeInMillis
|
||||||
date.contains("Yesterday") -> Calendar.getInstance().apply { add(Calendar.DAY_OF_MONTH, -1) }.timeInMillis
|
date.contains("Yesterday") -> Calendar.getInstance().apply { add(Calendar.DAY_OF_MONTH, -1) }.timeInMillis
|
||||||
else -> {
|
else -> SimpleDateFormat("MMM dd,yyyy", Locale.US).tryParse(date)
|
||||||
try {
|
|
||||||
SimpleDateFormat("MMM dd,yyyy", Locale.US).parse(date)?.time ?: 0L
|
|
||||||
} catch (e: Exception) {
|
|
||||||
0L
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import org.koitharu.kotatsu.base.domain.MangaLoaderContext
|
|||||||
import org.koitharu.kotatsu.core.exceptions.ParseException
|
import org.koitharu.kotatsu.core.exceptions.ParseException
|
||||||
import org.koitharu.kotatsu.core.model.*
|
import org.koitharu.kotatsu.core.model.*
|
||||||
import org.koitharu.kotatsu.core.parser.RemoteMangaRepository
|
import org.koitharu.kotatsu.core.parser.RemoteMangaRepository
|
||||||
|
import org.koitharu.kotatsu.utils.WordSet
|
||||||
import org.koitharu.kotatsu.utils.ext.*
|
import org.koitharu.kotatsu.utils.ext.*
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -139,7 +140,7 @@ class MangareadRepository(
|
|||||||
name = a!!.ownText(),
|
name = a!!.ownText(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
date_upload = parseChapterDate(doc2.select("span.chapter-release-date i").firstOrNull()?.text()),
|
uploadDate = parseChapterDate(doc2.selectFirst("span.chapter-release-date i")?.text()),
|
||||||
source = MangaSource.MANGAREAD
|
source = MangaSource.MANGAREAD
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -166,15 +167,6 @@ class MangareadRepository(
|
|||||||
|
|
||||||
private fun parseChapterDate(date: String?): Long {
|
private fun parseChapterDate(date: String?): Long {
|
||||||
date ?: return 0
|
date ?: return 0
|
||||||
|
|
||||||
fun SimpleDateFormat.tryParse(string: String): Long {
|
|
||||||
return try {
|
|
||||||
parse(string)?.time ?: 0
|
|
||||||
} catch (_: ParseException) {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
date.endsWith(" ago", ignoreCase = true) -> {
|
date.endsWith(" ago", ignoreCase = true) -> {
|
||||||
parseRelativeDate(date)
|
parseRelativeDate(date)
|
||||||
@@ -254,5 +246,3 @@ class MangareadRepository(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WordSet(private vararg val words: String) { fun anyWordIn(dateString: String): Boolean = words.any { dateString.contains(it, ignoreCase = true) } }
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ abstract class NineMangaRepository(
|
|||||||
name = a.text(),
|
name = a.text(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
date_upload = parseChapterDateByLang(li.select("span").text()),
|
uploadDate = parseChapterDateByLang(li.selectFirst("span")?.text().orEmpty()),
|
||||||
source = source,
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -166,11 +166,7 @@ abstract class NineMangaRepository(
|
|||||||
|
|
||||||
if (dateWords.size == 3) {
|
if (dateWords.size == 3) {
|
||||||
if (dateWords[1].contains(",")) {
|
if (dateWords[1].contains(",")) {
|
||||||
return try {
|
SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).tryParse(date)
|
||||||
SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).parse(date)?.time ?: 0L
|
|
||||||
} catch (e: ParseException) {
|
|
||||||
0L
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
val timeAgo = Integer.parseInt(dateWords[0])
|
val timeAgo = Integer.parseInt(dateWords[0])
|
||||||
return Calendar.getInstance().apply {
|
return Calendar.getInstance().apply {
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class RemangaRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposito
|
|||||||
append(name)
|
append(name)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
date_upload = parseChapterDate(jo.getString("upload_date")),
|
uploadDate = parseChapterDate(jo.getString("upload_date")),
|
||||||
scanlator = publishers.optJSONObject(0)?.getStringOrNull("name"),
|
scanlator = publishers.optJSONObject(0)?.getStringOrNull("name"),
|
||||||
source = MangaSource.REMANGA
|
source = MangaSource.REMANGA
|
||||||
)
|
)
|
||||||
@@ -179,11 +179,7 @@ class RemangaRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposito
|
|||||||
)
|
)
|
||||||
|
|
||||||
private fun parseChapterDate(string: String): Long {
|
private fun parseChapterDate(string: String): Long {
|
||||||
return try {
|
return SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US).tryParse(string)
|
||||||
dateFormat.parse(string)?.time ?: 0
|
|
||||||
} catch (_: ParseException) {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
@@ -194,9 +190,5 @@ class RemangaRepository(loaderContext: MangaLoaderContext) : RemoteMangaReposito
|
|||||||
const val STATUS_FINISHED = 0
|
const val STATUS_FINISHED = 0
|
||||||
|
|
||||||
val LAST_URL_PATH_REGEX = Regex("/[^/]+/?$")
|
val LAST_URL_PATH_REGEX = Regex("/[^/]+/?$")
|
||||||
|
|
||||||
private val dateFormat by lazy {
|
|
||||||
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ class YaoiChanRepository(loaderContext: MangaLoaderContext) : ChanRepository(loa
|
|||||||
name = a.text().trim(),
|
name = a.text().trim(),
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
url = href,
|
url = href,
|
||||||
date_upload = 0L,
|
uploadDate = 0L,
|
||||||
source = source
|
source = source
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ fun chapterListItemAD(
|
|||||||
val settings = GlobalContext.get().get<AppSettings>()
|
val settings = GlobalContext.get().get<AppSettings>()
|
||||||
val descriptions = mutableListOf<CharSequence>()
|
val descriptions = mutableListOf<CharSequence>()
|
||||||
val dateFormat = settings.dateFormat()
|
val dateFormat = settings.dateFormat()
|
||||||
if (item.chapter.date_upload > 0) {
|
if (item.chapter.uploadDate > 0) {
|
||||||
descriptions.add(dateFormat.format(Date(item.chapter.date_upload)))
|
descriptions.add(dateFormat.format(Date(item.chapter.uploadDate)))
|
||||||
}
|
}
|
||||||
if (!item.chapter.scanlator.isNullOrBlank()) {
|
if (!item.chapter.scanlator.isNullOrBlank()) {
|
||||||
descriptions.add(item.chapter.scanlator!!)
|
descriptions.add(item.chapter.scanlator!!)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class MangaIndex(source: String?) {
|
|||||||
jo.put("number", chapter.number)
|
jo.put("number", chapter.number)
|
||||||
jo.put("url", chapter.url)
|
jo.put("url", chapter.url)
|
||||||
jo.put("name", chapter.name)
|
jo.put("name", chapter.name)
|
||||||
jo.put("date_upload", chapter.date_upload)
|
jo.put("uploadDate", chapter.uploadDate)
|
||||||
jo.put("scanlator", chapter.scanlator)
|
jo.put("scanlator", chapter.scanlator)
|
||||||
jo.put("branch", chapter.branch)
|
jo.put("branch", chapter.branch)
|
||||||
jo.put("entries", "%03d\\d{3}".format(chapter.number))
|
jo.put("entries", "%03d\\d{3}".format(chapter.number))
|
||||||
@@ -100,7 +100,7 @@ class MangaIndex(source: String?) {
|
|||||||
name = v.getString("name"),
|
name = v.getString("name"),
|
||||||
url = v.getString("url"),
|
url = v.getString("url"),
|
||||||
number = v.getInt("number"),
|
number = v.getInt("number"),
|
||||||
date_upload = v.getLong("date_upload"),
|
uploadDate = v.getLong("uploadDate"),
|
||||||
scanlator = v.getStringOrNull("scanlator"),
|
scanlator = v.getStringOrNull("scanlator"),
|
||||||
branch = v.getStringOrNull("branch"),
|
branch = v.getStringOrNull("branch"),
|
||||||
source = source
|
source = source
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class LocalMangaRepository(private val context: Context) : MangaRepository {
|
|||||||
name = s.ifEmpty { title },
|
name = s.ifEmpty { title },
|
||||||
number = i + 1,
|
number = i + 1,
|
||||||
source = MangaSource.LOCAL,
|
source = MangaSource.LOCAL,
|
||||||
date_upload = 0L,
|
uploadDate = 0L,
|
||||||
url = uriBuilder.fragment(s).build().toString()
|
url = uriBuilder.fragment(s).build().toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
9
app/src/main/java/org/koitharu/kotatsu/utils/WordSet.kt
Normal file
9
app/src/main/java/org/koitharu/kotatsu/utils/WordSet.kt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package org.koitharu.kotatsu.utils
|
||||||
|
|
||||||
|
class WordSet(private vararg val words: String) {
|
||||||
|
|
||||||
|
fun anyWordIn(dateString: String): Boolean = words.any {
|
||||||
|
dateString.contains(it, ignoreCase = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import org.jsoup.nodes.Document
|
|||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import org.jsoup.nodes.Node
|
import org.jsoup.nodes.Node
|
||||||
import org.jsoup.select.Elements
|
import org.jsoup.select.Elements
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
|
||||||
fun Response.parseHtml(): Document {
|
fun Response.parseHtml(): Document {
|
||||||
try {
|
try {
|
||||||
@@ -97,4 +98,8 @@ fun Element.css(property: String): String? {
|
|||||||
val regex = Regex("${Regex.escape(property)}\\s*:\\s*[^;]+")
|
val regex = Regex("${Regex.escape(property)}\\s*:\\s*[^;]+")
|
||||||
val css = attr("style").find(regex) ?: return null
|
val css = attr("style").find(regex) ?: return null
|
||||||
return css.substringAfter(':').removeSuffix(';').trim()
|
return css.substringAfter(':').removeSuffix(';').trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun SimpleDateFormat.tryParse(str: String): Long = runCatching {
|
||||||
|
parse(str)?.time ?: 0L
|
||||||
|
}.getOrDefault(0L)
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
<shape
|
<shape
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="#202124" />
|
<solid android:color="#272727" />
|
||||||
<corners android:radius="4dp" />
|
<corners android:radius="4dp" />
|
||||||
</shape>
|
</shape>
|
||||||
Reference in New Issue
Block a user