if let links = doc?.search(withXPathQuery: "//a") {
for hppleElement in links {
let model = hppleElement as! TFHppleElement
print(model.content) // this is nil
print(model.object(forKey: "href"))
print(model.raw)
let data2 = model.raw.data(using: .utf8)
let doc2 = TFHpple.init(htmlData: data2)
if let model2 = doc2?.peekAtSearch(withXPathQuery: "//a") {
print(model2.content) // this is nil
// titleArr.append(model2.content)
}
urlArr.append(model.object(forKey: "href"))
}
}
"<a class="ke-insertfile" href="http://lonfile.5397078.cn/group1AABkuRGEBBM38.docx"
target="_blank">title- 13.docx"
I can not get the title of "title- 13.docx",why?
if let links = doc?.search(withXPathQuery: "//a") { for hppleElement in links { let model = hppleElement as! TFHppleElement print(model.content) // this is nil print(model.object(forKey: "href")) print(model.raw) let data2 = model.raw.data(using: .utf8) let doc2 = TFHpple.init(htmlData: data2) if let model2 = doc2?.peekAtSearch(withXPathQuery: "//a") { print(model2.content) // this is nil // titleArr.append(model2.content) } urlArr.append(model.object(forKey: "href")) } }