fix(core): update

This commit is contained in:
Philipp Kunz 2020-10-25 22:11:00 +00:00
parent 7eda660b29
commit bf8536e6ca
5 changed files with 40 additions and 4 deletions

20
package-lock.json generated
View File

@ -9405,6 +9405,22 @@
} }
} }
}, },
"rss-parser": {
"version": "3.9.0",
"resolved": "https://verdaccio.lossless.one/rss-parser/-/rss-parser-3.9.0.tgz",
"integrity": "sha512-wlRSfGrotOXuWo19Dtl2KmQt7o9i5zzCExUrxpechE0O54BAx7JD+xhWyGumPPqiJj771ndflV3sE3bTHen0HQ==",
"requires": {
"entities": "^2.0.3",
"xml2js": "^0.4.19"
},
"dependencies": {
"entities": {
"version": "2.1.0",
"resolved": "https://verdaccio.lossless.one/entities/-/entities-2.1.0.tgz",
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
}
}
},
"rxjs": { "rxjs": {
"version": "6.6.3", "version": "6.6.3",
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.6.3.tgz", "resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.6.3.tgz",
@ -10956,7 +10972,6 @@
"version": "0.4.23", "version": "0.4.23",
"resolved": "https://verdaccio.lossless.one/xml2js/-/xml2js-0.4.23.tgz", "resolved": "https://verdaccio.lossless.one/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"dev": true,
"requires": { "requires": {
"sax": ">=0.6.0", "sax": ">=0.6.0",
"xmlbuilder": "~11.0.0" "xmlbuilder": "~11.0.0"
@ -10965,8 +10980,7 @@
"xmlbuilder": { "xmlbuilder": {
"version": "11.0.1", "version": "11.0.1",
"resolved": "https://verdaccio.lossless.one/xmlbuilder/-/xmlbuilder-11.0.1.tgz", "resolved": "https://verdaccio.lossless.one/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
"dev": true
}, },
"xmlchars": { "xmlchars": {
"version": "2.2.0", "version": "2.2.0",

View File

@ -21,7 +21,8 @@
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"feed": "^4.2.1" "feed": "^4.2.1",
"rss-parser": "^3.9.0"
}, },
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"

View File

@ -27,6 +27,13 @@ tap.test('should create a feed', async () => {
}); });
const rssFeed = feed.exportRssFeedString(); const rssFeed = feed.exportRssFeedString();
console.log(rssFeed); console.log(rssFeed);
const parsedFeed = await testSmartFeed.parseFeedFromString(rssFeed);
console.log(parsedFeed);
});
tap.test('should parse a Url', async () => {
const result = await testSmartFeed.parseFeedFromUrl('https://www.theverge.com/rss/index.xml');
// console.log(result);
}); });
tap.start(); tap.start();

View File

@ -6,4 +6,16 @@ export class Smartfeed {
const feedVersion = new Feed(optionsArg); const feedVersion = new Feed(optionsArg);
return feedVersion; return feedVersion;
} }
public async parseFeedFromString(rssFeedString: string) {
const parser = new plugins.rssParser();
const resultingFeed = await parser.parseString(rssFeedString);
return resultingFeed;
}
public async parseFeedFromUrl(urlArg: string) {
const parser = new plugins.rssParser();
const resultingFeed = await parser.parseURL(urlArg);
return resultingFeed;
}
} }

View File

@ -1,6 +1,8 @@
// third party scope // third party scope
import rssParser from 'rss-parser';
import * as feed from 'feed'; import * as feed from 'feed';
export { export {
rssParser,
feed feed
}; };