Fix search: add old_ent category, fix thumbnail URL, improve title extraction
This commit is contained in:
@@ -547,7 +547,7 @@ class TvmonScraper {
|
|||||||
val results = mutableListOf<Content>()
|
val results = mutableListOf<Content>()
|
||||||
val seen = mutableSetOf<String>()
|
val seen = mutableSetOf<String>()
|
||||||
|
|
||||||
val allLinks = doc.select("a[href*='/movie/'], a[href*='/drama/'], a[href*='/ent/'], a[href*='/world/'], a[href*='/animation/'], a[href*='/kor_movie/']")
|
val allLinks = doc.select("a.poster[href*='/movie/'], a.poster[href*='/drama/'], a.poster[href*='/ent/'], a.poster[href*='/world/'], a.poster[href*='/animation/'], a.poster[href*='/kor_movie/'], a.poster[href*='/old_ent/'], a.poster[href*='/sisa/'], a.poster[href*='/ott_ent/'], a.poster[href*='/ani_movie/']")
|
||||||
|
|
||||||
for (link in allLinks) {
|
for (link in allLinks) {
|
||||||
val href = link.attr("href")
|
val href = link.attr("href")
|
||||||
@@ -564,12 +564,19 @@ class TvmonScraper {
|
|||||||
val category = getCategoryFromUrl(href)
|
val category = getCategoryFromUrl(href)
|
||||||
|
|
||||||
val imgTag = link.selectFirst("img")
|
val imgTag = link.selectFirst("img")
|
||||||
val imgUrl = imgTag?.attr("src") ?: imgTag?.attr("data-src") ?: ""
|
var imgUrl = imgTag?.attr("src") ?: imgTag?.attr("data-src") ?: ""
|
||||||
|
// 상대 경로인 경우 BASE_URL을 앞에 붙임
|
||||||
|
if (imgUrl.isNotBlank() && !imgUrl.startsWith("http")) {
|
||||||
|
imgUrl = BASE_URL + imgUrl
|
||||||
|
}
|
||||||
|
|
||||||
var title = link.text()
|
var title = ""
|
||||||
|
val titleLink = link.parent()?.selectFirst("a.title")
|
||||||
|
if (titleLink != null) {
|
||||||
|
title = titleLink.text().trim()
|
||||||
|
}
|
||||||
if (title.isBlank()) {
|
if (title.isBlank()) {
|
||||||
val titleTag = link.selectFirst(".title, .movie-title")
|
title = link.attr("title").ifBlank { link.text().trim() }
|
||||||
title = titleTag?.text() ?: ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title.isNotBlank()) {
|
if (title.isNotBlank()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user