return title as a header
parent
90fb16b81e
commit
dc5605abaa
3
index.js
3
index.js
|
@ -37,6 +37,9 @@ app.listen(port, () => {
|
||||||
|
|
||||||
function read_url(url, res) {
|
function read_url(url, res) {
|
||||||
JSDOM.fromURL(url).then((document)=>{
|
JSDOM.fromURL(url).then((document)=>{
|
||||||
|
let title = document.window.document.querySelector('title');
|
||||||
|
if (title)
|
||||||
|
res.header("X-Title", title.textContent);
|
||||||
let reader = new Readability(document.window.document);
|
let reader = new Readability(document.window.document);
|
||||||
let article = reader.parse();
|
let article = reader.parse();
|
||||||
let markdown = service.turndown(article.content);
|
let markdown = service.turndown(article.content);
|
||||||
|
|
Loading…
Reference in New Issue