date bug fixed

This commit is contained in:
LagradOst 2021-09-20 00:58:23 +02:00
parent b631307b09
commit 6a561a35c0

View file

@ -35,11 +35,6 @@ class TenshiProvider : MainAPI() {
override val supportedTypes: Set<TvType> override val supportedTypes: Set<TvType>
get() = setOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA) get() = setOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA)
private fun autoLoadToken(): Boolean {
if (token != null) return true
return loadToken()
}
private fun loadToken(): Boolean { private fun loadToken(): Boolean {
return try { return try {
val response = khttp.get(mainUrl) val response = khttp.get(mainUrl)
@ -147,11 +142,10 @@ class TenshiProvider : MainAPI() {
private fun dateParser(dateString: String): String? { private fun dateParser(dateString: String): String? {
val format = SimpleDateFormat("dd 'of' MMM',' yyyy") val format = SimpleDateFormat("dd 'of' MMM',' yyyy")
val newFormat = SimpleDateFormat("dd-MM-yyyy") val newFormat = SimpleDateFormat("dd-MM-yyyy")
return newFormat.format( val data = format.parse(
format.parse(
dateString.replace("th ", " ").replace("st ", " ").replace("nd ", " ").replace("rd ", " ") dateString.replace("th ", " ").replace("st ", " ").replace("nd ", " ").replace("rd ", " ")
) ) ?: return null
) return newFormat.format(data)
} }
// data class TenshiSearchResponse( // data class TenshiSearchResponse(
@ -235,12 +229,12 @@ class TenshiProvider : MainAPI() {
val episodeNodes = document.select("li[class*=\"episode\"] > a") val episodeNodes = document.select("li[class*=\"episode\"] > a")
val episodes = ArrayList<AnimeEpisode>(episodeNodes?.map { val episodes = ArrayList(episodeNodes?.map {
AnimeEpisode( AnimeEpisode(
it.attr("href"), it.attr("href"),
it.selectFirst(".episode-title")?.text()?.trim(), it.selectFirst(".episode-title")?.text()?.trim(),
it.selectFirst("img")?.attr("src"), it.selectFirst("img")?.attr("src"),
dateParser(it.selectFirst(".episode-date").text().trim()).toString(), dateParser(it.selectFirst(".episode-date").text().trim()),
null, null,
it.attr("data-content").trim(), it.attr("data-content").trim(),
) )