Skip to content

Commit ebf7fd7

Browse files
committed
Description added
1 parent 3da0ca4 commit ebf7fd7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/commands/FetchPreview.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,23 @@ export default class FetchPreview extends BaseCommand {
3434
url = $(`img`).attr("src");
3535
}
3636

37+
let title = $(`title`).text();
38+
39+
let description = $(`meta[name=description]`).attr("content") || $(`meta[property=og\\:description]`).attr("content");
40+
3741
const file = await TempFileService.getTempFile(".jpg");
3842
await TempFileService.fetch(url, file.path);
3943

4044
await this.upload({ url: output , filePath: file.path});
4145

4246
return {
4347
statusCode: 200,
44-
body: JSON.stringify(url),
48+
body: JSON.stringify({
49+
url,
50+
title,
51+
description,
52+
none
53+
}),
4554
headers: {
4655
"content-type": "application/json"
4756
}

0 commit comments

Comments
 (0)