Scraping: Remove workaround for last-child

Last-child is not supported on SwiftSoup, but nth-last-child is.
Therefore, sources must use nth-child or nth-last-child instead of
the first-child and last-child aliases.

Signed-off-by: kingbri <bdashore3@gmail.com>
This commit is contained in:
kingbri 2022-07-30 14:37:30 -04:00
parent 6cc9221fe4
commit d3ee5c5bc9

View file

@ -106,15 +106,8 @@ class ScrapingViewModel: ObservableObject {
let magnetHash = fetchMagnetHash(magnetLink: href)
var title: String?
// Some sources may use last-child, but SwiftSoup doesn't support it
if let titleQuery = source.titleQuery {
if titleQuery.contains("last-child") {
let newTitleQuery = titleQuery.replacingOccurrences(of: ":last-child", with: "")
title = try row.select(newTitleQuery).last()?.text()
} else {
title = try row.select(titleQuery).first()?.text()
}
title = try row.select(titleQuery).first()?.text()
}
let size = try row.select(source.sizeQuery ?? "").first()