1- import { Readable } from "stream" ;
1+ import { Readable } from "node: stream" ;
22import _debug from "debug" ;
33import FeedMe from "feedme" ;
44import type { FeedObject } from "feedme/dist/parser" ;
@@ -12,11 +12,11 @@ const findHtmlLink = (array: FeedObject[]): string | undefined => {
1212 const link = array . find (
1313 ( item ) =>
1414 typeof item === "object" &&
15- item [ " rel" ] === "alternate" &&
16- item [ " type" ] === "text/html" ,
15+ item . rel === "alternate" &&
16+ item . type === "text/html" ,
1717 ) ;
18- if ( typeof link === "object" && typeof link ?. [ " href" ] === "string" ) {
19- return link ?. [ " href" ] || undefined ;
18+ if ( typeof link === "object" && typeof link ?. href === "string" ) {
19+ return link ?. href || undefined ;
2020 }
2121 return undefined ;
2222} ;
@@ -107,23 +107,23 @@ export function parse(feed: string): Promise<ParserResponse> {
107107 try {
108108 resolve ( {
109109 parser : "FEEDME" ,
110- title : unpack ( parsed [ " title" ] , "text" , true , "title" ) ,
111- description : unpack ( parsed [ " description" ] , "text" ) ,
112- home_page_url : evaluateLink ( parsed [ " link" ] ) ,
110+ title : unpack ( parsed . title , "text" , true , "title" ) ,
111+ description : unpack ( parsed . description , "text" ) ,
112+ home_page_url : evaluateLink ( parsed . link ) ,
113113 feed_url : undefined ,
114114 items : parsed . items . map ( ( item ) : Item => {
115- const pubDate = unpack ( item [ " pubdate" ] , "text" ) ;
115+ const pubDate = unpack ( item . pubdate , "text" ) ;
116116 return {
117- title : unpack ( item [ " title" ] , "text" ) ,
118- url : evaluateLink ( item [ " link" ] ) ,
119- id : unpack ( item [ "id" ] || item [ " guid" ] , "text" , true , "id" ) ,
120- content_html : unpack ( item [ " description" ] , "text" ) ,
121- tags : unpackArray ( item [ " category" ] , "text" ) ,
117+ title : unpack ( item . title , "text" ) ,
118+ url : evaluateLink ( item . link ) ,
119+ id : unpack ( item . id || item . guid , "text" , true , "id" ) ,
120+ content_html : unpack ( item . description , "text" ) ,
121+ tags : unpackArray ( item . category , "text" ) ,
122122 date_published : pubDate
123123 ? new Date ( pubDate ) . toISOString ( )
124124 : pubDate ,
125- authors : unpack ( item [ " author" ] , "name" )
126- ? [ { name : unpack ( item [ " author" ] , "name" ) } ]
125+ authors : unpack ( item . author , "name" )
126+ ? [ { name : unpack ( item . author , "name" ) } ]
127127 : [ ] ,
128128 } ;
129129 } ) ,
0 commit comments