I am trying to parse some data form a website but I just can't get it working.
I tried NDHpple, TFHpple, Kanna all of them without success.
I want to parse:
<td class="date">17:08</td>
And the XPath I get to it, using Firebug, is:
/html/body/section/div/section/article/div[1]/div[2]/div/table/tbody/tr[1]/td[1]
Right now I am using Kanna and my code is this:
@IBAction func btnLoadData(sender: NSButton) {
if let doc = Kanna.HTML(url: (NSURL(string: "the_site_url")!), encoding: NSUTF8StringEncoding) {
// Search for nodes by XPath
for link in doc.xpath("/html/body/section/div/section/article/div[1]/div[2]/div/table/tbody/tr[1]/td[1]") {
print(link.text)
print(link["href"])
}
}
}
So, anyone can help me?