Skip to content

Commit 8d65cd1

Browse files
authored
Merge pull request #70 from extractus/6.1.7
v6.1.7
2 parents 59af400 + e936b3e commit 8d65cd1

File tree

7 files changed

+19
-33
lines changed

7 files changed

+19
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ git clone https://github.com/extractus/feed-extractor.git
231231
cd feed-extractor
232232
npm install
233233

234-
node eval.js --url=https://news.google.com/rss --normalization=y --useISODateFormat=y --includeEntryContent=n --includeOptionalElements=n
234+
npm run eval https://news.google.com/rss
235235
```
236236

237237
## License

dist/cjs/feed-extractor.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "@extractus/feed-extractor",
3-
"version": "6.1.6",
3+
"version": "6.1.7",
44
"main": "./feed-extractor.js"
55
}

dist/feed-extractor.esm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @extractus/feed-extractor@6.1.6, by @extractus - built with esbuild at 2022-12-05T01:51:24.880Z - published under MIT license
1+
// @extractus/feed-extractor@6.1.7, by @extractus - built with esbuild at 2022-12-06T05:40:03.694Z - published under MIT license
22
var __create = Object.create;
33
var __defProp = Object.defineProperty;
44
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1896,7 +1896,7 @@ var retrieve_default = async (url, options = {}) => {
18961896
}
18971897
const contentType = res.headers.get("content-type");
18981898
const text = await res.text();
1899-
if (/(\+|\/)xml/.test(contentType)) {
1899+
if (/(\+|\/)(xml|html)/.test(contentType)) {
19001900
return { type: "xml", text: text.trim(), status, contentType };
19011901
}
19021902
if (/(\+|\/)json/.test(contentType)) {

eval.js

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,23 @@
11
// eval.js
2-
3-
// import { writeFileSync } from 'fs'
4-
5-
import parseArgs from 'args-parser'
2+
// to quickly test with a single url or file
63

74
import { read } from './src/main.js'
85

9-
const extractFromUrl = async (url, options) => {
6+
const run = async (url) => {
107
try {
11-
const feed = await read(url, options)
12-
console.log(feed)
13-
// writeFileSync('output.json', JSON.stringify(feed, undefined, 2), 'utf8')
8+
const art = await read(url)
9+
console.log(art)
1410
} catch (err) {
15-
console.log(err)
11+
console.trace(err)
1612
}
1713
}
1814

1915
const init = (argv) => {
20-
const {
21-
url,
22-
normalization = 'y',
23-
includeEntryContent = 'n',
24-
includeOptionalElements = 'n',
25-
useISODateFormat = 'y'
26-
} = parseArgs(argv)
27-
28-
const options = {
29-
includeEntryContent: includeEntryContent === 'y',
30-
includeOptionalElements: includeOptionalElements === 'y',
31-
useISODateFormat: useISODateFormat !== 'n',
32-
normalization: normalization !== 'n'
16+
if (argv.length === 3) {
17+
const url = argv[2]
18+
return run(url)
3319
}
34-
return url ? extractFromUrl(url, options) : false
20+
return 'Nothing to do!'
3521
}
3622

3723
init(process.argv)

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "6.1.6",
2+
"version": "6.1.7",
33
"name": "@extractus/feed-extractor",
44
"description": "To read and normalize RSS/ATOM/JSON feed data",
55
"homepage": "https://github.com/extractus/feed-extractor",
@@ -29,6 +29,7 @@
2929
"lint:fix": "standard --fix",
3030
"pretest": "npm run lint",
3131
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage=true",
32+
"eval": "node eval",
3233
"build": "node build",
3334
"reset": "node reset"
3435
},
@@ -39,8 +40,7 @@
3940
"html-entities": "^2.3.3"
4041
},
4142
"devDependencies": {
42-
"args-parser": "^1.3.0",
43-
"esbuild": "^0.15.17",
43+
"esbuild": "^0.15.18",
4444
"jest": "^29.3.1",
4545
"nock": "^13.2.9",
4646
"standard": "^17.0.0"

src/utils/retrieve.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default async (url, options = {}) => {
3030
const contentType = res.headers.get('content-type')
3131
const text = await res.text()
3232

33-
if (/(\+|\/)xml/.test(contentType)) {
33+
if (/(\+|\/)(xml|html)/.test(contentType)) {
3434
return { type: 'xml', text: text.trim(), status, contentType }
3535
}
3636

0 commit comments

Comments
 (0)