Spaces:
Build error
Build error
feat: return description
Browse files
backend/functions/src/services/puppeteer.ts
CHANGED
|
@@ -42,6 +42,7 @@ export interface ReadabilityParsed {
|
|
| 42 |
|
| 43 |
export interface PageSnapshot {
|
| 44 |
title: string;
|
|
|
|
| 45 |
href: string;
|
| 46 |
rebase?: string;
|
| 47 |
html: string;
|
|
@@ -167,6 +168,7 @@ function giveSnapshot(stopActiveSnapshot) {
|
|
| 167 |
const domAnalysis = getMaxDepthAndCountUsingTreeWalker(document.documentElement);
|
| 168 |
const r = {
|
| 169 |
title: document.title,
|
|
|
|
| 170 |
href: document.location.href,
|
| 171 |
html: document.documentElement?.outerHTML,
|
| 172 |
text: document.body?.innerText,
|
|
|
|
| 42 |
|
| 43 |
export interface PageSnapshot {
|
| 44 |
title: string;
|
| 45 |
+
description: string;
|
| 46 |
href: string;
|
| 47 |
rebase?: string;
|
| 48 |
html: string;
|
|
|
|
| 168 |
const domAnalysis = getMaxDepthAndCountUsingTreeWalker(document.documentElement);
|
| 169 |
const r = {
|
| 170 |
title: document.title,
|
| 171 |
+
description: document.head?.querySelector('meta[name="description"]')?.getAttribute('content') ?? '',
|
| 172 |
href: document.location.href,
|
| 173 |
html: document.documentElement?.outerHTML,
|
| 174 |
text: document.body?.innerText,
|
backend/functions/src/services/snapshot-formatter.ts
CHANGED
|
@@ -316,6 +316,7 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 316 |
|
| 317 |
const formatted: FormattedPage = {
|
| 318 |
title: (snapshot.parsed?.title || snapshot.title || '').trim(),
|
|
|
|
| 319 |
url: nominalUrl?.toString() || snapshot.href?.trim(),
|
| 320 |
content: cleanText,
|
| 321 |
publishedTime: snapshot.parsed?.publishedTime || undefined,
|
|
|
|
| 316 |
|
| 317 |
const formatted: FormattedPage = {
|
| 318 |
title: (snapshot.parsed?.title || snapshot.title || '').trim(),
|
| 319 |
+
description: (snapshot.description || '').trim(),
|
| 320 |
url: nominalUrl?.toString() || snapshot.href?.trim(),
|
| 321 |
content: cleanText,
|
| 322 |
publishedTime: snapshot.parsed?.publishedTime || undefined,
|