Embed Threads quote

This commit is contained in:
Thomas Ricouard 2024-09-18 16:53:54 +02:00
parent 4dd4968bb2
commit 23960d6d0f

View file

@ -139,10 +139,14 @@ public struct HTMLString: Codable, Equatable, Hashable, @unchecked Sendable {
} else if node.nodeName() == "a" { } else if node.nodeName() == "a" {
let href = try node.attr("href") let href = try node.attr("href")
if href != "" { if href != "" {
if let url = URL(string: href), if let url = URL(string: href) {
let _ = Int(url.lastPathComponent) if Int(url.lastPathComponent) != nil {
{
statusesURLs.append(url) statusesURLs.append(url)
} else if url.host() == "www.threads.net" || url.host() == "threads.net",
url.pathComponents.count == 4,
url.pathComponents[2] == "post" {
statusesURLs.append(url)
}
} }
} }
asMarkdown += "[" asMarkdown += "["