delay capture because font isn't loading

This commit is contained in:
keyan 2022-02-03 13:41:09 -06:00
parent 8b88462591
commit 075d147f63
2 changed files with 19 additions and 2 deletions

View File

@ -324,6 +324,12 @@ export default {
} }
} }
} }
},
highlight: {
fields: {
title: { number_of_fragments: 0, pre_tags: ['***'], post_tags: ['***'] },
text: { number_of_fragments: 0, pre_tags: ['***'], post_tags: ['***'] }
}
} }
} }
}) })
@ -335,7 +341,18 @@ export default {
} }
} }
const items = sitems.body.hits.hits.map(e => e._source) // return highlights
const items = sitems.body.hits.hits.map(e => {
const item = e._source
if (e.highlight?.title) {
item.title = e.highlight.title[0]
}
if (e.highlight?.text) {
item.text = e.highlight.text[0]
}
return item
})
return { return {
cursor: items.length === LIMIT ? nextCursorEncoded(decodedCursor) : null, cursor: items.length === LIMIT ? nextCursorEncoded(decodedCursor) : null,
items items

View File

@ -4,7 +4,7 @@ const Pageres = require('pageres')
async function captureUrl () { async function captureUrl () {
try { try {
const streams = await new Pageres({ crop: true, scale: 2, timeout: 10, launchOptions: { args: ['--single-process'] } }) const streams = await new Pageres({ crop: true, delay: 1, scale: 2, timeout: 10, launchOptions: { args: ['--single-process'] } })
.src(process.argv[2], ['600x315']) .src(process.argv[2], ['600x315'])
.run() .run()
process.stdout.write(streams[0], () => process.exit(0)) process.stdout.write(streams[0], () => process.exit(0))