PutLocker: fix full episodes not listing (#1037)

This commit is contained in:
Samfun75
2022-11-22 15:23:10 +03:00
committed by GitHub
parent 17ec32dec1
commit 9f13e91b00
2 changed files with 26 additions and 29 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'PutLocker' extName = 'PutLocker'
pkgNameSuffix = 'en.putlocker' pkgNameSuffix = 'en.putlocker'
extClass = '.PutLocker' extClass = '.PutLocker'
extVersionCode = 1 extVersionCode = 2
libVersion = '13' libVersion = '13'
} }

View File

@ -109,13 +109,14 @@ class PutLocker : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
} ?: SAnime.COMPLETED } ?: SAnime.COMPLETED
var description = descElement.select("div.desc").text()?.let { it + "\n" } var description = descElement.select("div.desc").text()?.let { it + "\n" }
document.select("div.mvic-info > div.mvici-right p:contains(Quality)").text().let { val extraDescription = document.select("div.mvic-info > div.mvici-right")
extraDescription.select("p:contains(Quality)").text().let {
description += if (it.isNotBlank()) "\n$it" else "" description += if (it.isNotBlank()) "\n$it" else ""
} }
document.select("div.mvic-info > div.mvici-right p:contains(Release)").text().let { extraDescription.select("p:contains(Release)").text().let {
description += if (it.isNotBlank()) "\n$it" else "" description += if (it.isNotBlank()) "\n$it" else ""
} }
document.select("div.mvic-info > div.mvici-right p:contains(IMDb)").text().let { extraDescription.select("p:contains(IMDb)").text().let {
description += if (it.isNotBlank()) "\n$it" else "" description += if (it.isNotBlank()) "\n$it" else ""
} }
anime.description = description anime.description = description
@ -135,34 +136,30 @@ class PutLocker : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val parsedHtml = Jsoup.parse(JSONUtil.unescape(html)) val parsedHtml = Jsoup.parse(JSONUtil.unescape(html))
val rawEpisodes = parsedHtml.select("div[id^=sv]").mapNotNull { server -> val rawEpisodes = parsedHtml.select("div[id^=sv]").mapNotNull { server ->
val linkElement = server.select("div.les-content > a") val linkElement = server.select("div.les-content > a")
val dataId = linkElement.attr("data-id")!! linkElement.map { epLinkElement ->
val ep = dataId.substringAfter("_").substringBefore("_").toInt() val dataId = epLinkElement.attr("data-id")!!
val title = if (ep == 0) { val ep = dataId.substringAfter("_").substringBefore("_").toInt()
"Movie" val title = if (ep == 0) {
} else { "Movie"
val epWithNumber = linkElement.text() } else {
"Episode $ep: " + linkElement.attr("title").substringAfter(epWithNumber) "Episode $ep: " + epLinkElement.attr("title").substringAfter("Episode $ep")
.replace("-", "").trim() .replace("-", "").trim()
}
Pair(title, dataId)
} }
Pair(title, dataId) }.flatten()
}
val episodes = mutableListOf<SEpisode>() return rawEpisodes.groupBy { it.second.substringAfter("_").substringBefore("_").toInt() }
rawEpisodes.groupBy { it.second.substringAfter("_").substringBefore("_").toInt() } .mapNotNull { group ->
.map { group -> SEpisode.create().apply {
val title = group.value.first().first url = EpLinks(
episodes.add( ep_num = group.key,
SEpisode.create().apply { ids = group.value.map { it.second }
url = EpLinks( ).toJson()
ep_num = group.key, name = group.value.first().first
ids = group.value.map { it.second } episode_number = group.key.toFloat()
).toJson() }
name = title
episode_number = group.key.toFloat()
}
)
} }
return episodes
} }
override fun episodeListSelector(): String = throw Exception("Not Used") override fun episodeListSelector(): String = throw Exception("Not Used")