-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from extractus/6.1.7
v6.1.7
- Loading branch information
Showing
7 changed files
with
19 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@extractus/feed-extractor", | ||
"version": "6.1.6", | ||
"version": "6.1.7", | ||
"main": "./feed-extractor.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// @extractus/[email protected].6, by @extractus - built with esbuild at 2022-12-05T01:51:24.880Z - published under MIT license | ||
// @extractus/[email protected].7, by @extractus - built with esbuild at 2022-12-06T05:40:03.694Z - published under MIT license | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
|
@@ -1896,7 +1896,7 @@ var retrieve_default = async (url, options = {}) => { | |
} | ||
const contentType = res.headers.get("content-type"); | ||
const text = await res.text(); | ||
if (/(\+|\/)xml/.test(contentType)) { | ||
if (/(\+|\/)(xml|html)/.test(contentType)) { | ||
return { type: "xml", text: text.trim(), status, contentType }; | ||
} | ||
if (/(\+|\/)json/.test(contentType)) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,23 @@ | ||
// eval.js | ||
|
||
// import { writeFileSync } from 'fs' | ||
|
||
import parseArgs from 'args-parser' | ||
// to quickly test with a single url or file | ||
|
||
import { read } from './src/main.js' | ||
|
||
const extractFromUrl = async (url, options) => { | ||
const run = async (url) => { | ||
try { | ||
const feed = await read(url, options) | ||
console.log(feed) | ||
// writeFileSync('output.json', JSON.stringify(feed, undefined, 2), 'utf8') | ||
const art = await read(url) | ||
console.log(art) | ||
} catch (err) { | ||
console.log(err) | ||
console.trace(err) | ||
} | ||
} | ||
|
||
const init = (argv) => { | ||
const { | ||
url, | ||
normalization = 'y', | ||
includeEntryContent = 'n', | ||
includeOptionalElements = 'n', | ||
useISODateFormat = 'y' | ||
} = parseArgs(argv) | ||
|
||
const options = { | ||
includeEntryContent: includeEntryContent === 'y', | ||
includeOptionalElements: includeOptionalElements === 'y', | ||
useISODateFormat: useISODateFormat !== 'n', | ||
normalization: normalization !== 'n' | ||
if (argv.length === 3) { | ||
const url = argv[2] | ||
return run(url) | ||
} | ||
return url ? extractFromUrl(url, options) : false | ||
return 'Nothing to do!' | ||
} | ||
|
||
init(process.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters