File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ interface ILinkPreviewResponse {
66 url : string ;
77 title : string ;
88 siteName : string | undefined ;
9+ author : string | undefined ;
910 description : string | undefined ;
1011 mediaType : string ;
1112 contentType : string | undefined ;
@@ -74,6 +75,13 @@ function getSiteName(doc: cheerio.Root) {
7475 return siteName ;
7576}
7677
78+ function getAuthor ( doc : cheerio . Root ) {
79+ const author =
80+ metaTagContent ( doc , `author` , `name` ) ||
81+ metaTagContent ( doc , `article:author` , `property` ) ;
82+ return author ;
83+ }
84+
7785function getDescription ( doc : cheerio . Root ) {
7886 const description =
7987 metaTagContent ( doc , `description` , `name` ) ||
@@ -301,6 +309,7 @@ function parseTextResponse(
301309 title : getTitle ( doc ) ,
302310 siteName : getSiteName ( doc ) ,
303311 description : getDescription ( doc ) ,
312+ author : getAuthor ( doc ) ,
304313 mediaType : getMediaType ( doc ) || `website` ,
305314 contentType,
306315 images : getImages ( doc , url , options . imagesPropertyType ) ,
You can’t perform that action at this time.
0 commit comments