return title as a header

main
Lee Hanken 2022-01-18 17:35:03 +00:00
parent 90fb16b81e
commit dc5605abaa
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,9 @@ app.listen(port, () => {
function read_url(url, res) {
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 article = reader.parse();
let markdown = service.turndown(article.content);