Skip to content

Commit 4c64103

Browse files
authored
Merge pull request #120 from fmacpro/codex/fix-mobile-screenshot-functionality-and-add-tests-p6b8nr
Enable screenshot capture in parseArticle
2 parents 5b3a187 + addd424 commit 4c64103

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ const articleParser = async function (browser, options, socket) {
549549
if (options.enabled.includes('screenshot') && timeLeft() > 300) {
550550
log('analyze', 'Capturing screenshot')
551551
try {
552-
article.mobile = await page.screenshot({ encoding: 'base64', type: 'jpeg', quality: 60 })
552+
article.screenshot = await page.screenshot({ encoding: 'base64', type: 'jpeg', quality: 60 })
553553
} catch { /* ignore screenshot failures (e.g., page closed on timeout) */ }
554554
}
555555

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "horseman-article-parser",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Web Page Inspection Tool. Sentiment Analysis, Keyword Extraction, Named Entity Recognition & Spell Check",
55
"type": "module",
66
"main": "index.js",

scripts/single-sample-run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
108108
metadescription: article.meta.description.text,
109109
url: article.url,
110110
siteicon: article.siteicon,
111-
mobile: article.mobile,
111+
screenshot: article.screenshot,
112112
sentiment: { score: article.sentiment.score, comparative: article.sentiment.comparative },
113113
keyphrases: article.processed.keyphrases,
114114
keywords: article.processed.keywords,

tests/parseArticle.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ test('parseArticle captures a screenshot when enabled', { timeout: TEST_TIMEOUT
7373
t.skip('puppeteer unavailable: ' + err.message)
7474
return
7575
}
76-
assert.equal(typeof article.mobile, 'string')
77-
assert.ok(Buffer.from(article.mobile, 'base64').length > 1000)
76+
assert.equal(typeof article.screenshot, 'string')
77+
assert.ok(Buffer.from(article.screenshot, 'base64').length > 1000)
7878
})
7979

8080
test('parseArticle uses rules overrides for title and content', { timeout: TEST_TIMEOUT }, async (t) => {

0 commit comments

Comments
 (0)