HackerNewsReader
HackerNewsReader copied to clipboard
HNR: Episode III - Revenge of the Parse
This fixes #13
Looks like an update to Hacker News' HTML broke the app's parsing. One single addition of a <tr>
was the culprit.
I'd also recommend updating http://whoisryannystrom.com/hackernews.json:
{
"feed": {
"titles": "//table[@id='hnmain']/tr[4]/td/table//td[@class='title'][not(@align)]/a",
"details": "//table[@id='hnmain']/tr[4]/td/table//td[@class='subtext']",
"score": "//span[@class='score']",
"comment_node": "(//a)[last()]"
},
"comments": {
"comments": "//table[@id='hnmain']/tr[4]/td/table[2]/tr",
"user": "//span[@class='comhead']/a[1]",
"text": "//span[@class='comment']/span",
"removed": "//span[@class='comment']",
"indent": "//img[@src='s.gif']",
"permalink": "//span[@class='age']/a"
},
"page": {
"text": "//table[@id='hnmain']/tr[4]/td/table[1]/tr[4]/td[2]"
},
"user": {
"username": "//table[@id='hnmain']/tr[4]/td//table//tr[1]/td[2]/a",
"created": "//table[@id='hnmain']/tr[4]/td//table//tr[2]/td[2]",
"karma": "//table[@id='hnmain']/tr[4]/td//table//tr[3]/td[2]",
"about": "//table[@id='hnmain']/tr[4]/td//table//tr[4]/td[2]",
}
}
It looks like they've changed the number of <tr>
s back to how it was before, so the problem solved itself... for now at least. We still may want to check tr[4]
as a fallback if tr[3]
queries return no results, though.
Let me know your thoughts.