An NPM module to parse given Hacker News HTML content. Generates an array of objects to consume. The JSON structure will be the same for every instance, with non-existing values presented as null
.
{
"title": "Swedish Academy Won’t Award Nobel Prize in Literature This Year",
"link": "https://www.wsj.com/articles/swedish-academy-wont-award-nobel-prize-in-literature-this-year-1525419104",
"siteString": "wsj.com",
"score": "19 points",
"user": {
"name": "dcgudeman",
"link": "user?id=dcgudeman"
},
"age": "49 minutes ago",
"commentCount": "14 comments",
"threadLink": "item?id=16992852"
}
npm install hn-parser
const parser = require('hn-parser')
const items = parser.parse(HTMLString);
npm run test
The project is under MIT license.