Use jsdom for parsing the document to determine readability (fixes #325)

pull/332/head
Gijs Kruitbosch 8 years ago
parent 4a0d08c56a
commit 46842048c1

@ -111,12 +111,25 @@ function runReadability(source, destPath, metadataDestPath) {
var myReader, result, readerable;
try {
myReader = new Readability(uri, doc);
readerable = myReader.isProbablyReaderable();
result = myReader.parse();
} catch (ex) {
console.error(ex);
ex.stack.forEach(console.log.bind(console));
}
// Use jsdom for isProbablyReaderable because it supports querySelectorAll
try {
var jsdomDoc = jsdom(source, {
features: {
FetchExternalResources: false,
ProcessExternalResources: false
}
});
myReader = new Readability(uri, jsdomDoc);
readerable = myReader.isProbablyReaderable();
} catch (ex) {
console.error(ex);
ex.stack.forEach(console.log.bind(console));
}
if (!result) {
console.error("No content generated by readability, not going to write expected.html!");
return;

@ -1,6 +1,7 @@
{
"title": "Open Verilog flow for Silego GreenPak4 programmable logic devices",
"byline": null,
"dir": "ltr",
"excerpt": "I've written a couple of posts in the past few months but they were all for",
"readerable": true
}

Loading…
Cancel
Save