Socket
Socket
Sign inDemoInstall

@extractus/feed-extractor

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@extractus/feed-extractor - npm Package Compare versions

Comparing version 7.1.1 to 7.1.2

25

package.json
{
"version": "7.1.1",
"version": "7.1.2",
"name": "@extractus/feed-extractor",

@@ -31,2 +31,12 @@ "description": "To read and normalize RSS/ATOM/JSON feed data",

},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"build": "node build",
"prepublishOnly": "npm run build",
"pretest": "npm run lint",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage=true",
"eval": "node eval",
"reset": "node reset"
},
"dependencies": {

@@ -54,12 +64,3 @@ "bellajs": "^11.1.3",

],
"license": "MIT",
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"build": "node build",
"pretest": "npm run lint",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest --verbose --coverage=true",
"eval": "node eval",
"reset": "node reset"
}
}
"license": "MIT"
}
// utils -> retrieve
import fetch from 'cross-fetch'
import { XMLParser } from 'fast-xml-parser'

@@ -18,2 +19,16 @@ const profetch = async (url, options = {}) => {

const getCharsetFromText = (text) => {
try {
const firstLine = text.split('\n')[0].trim().replace('<?', '<').replace('?>', '>')
const parser = new XMLParser({
ignoreAttributes: false,
})
let obj = parser.parse(firstLine)
const { xml: root = {} } = obj
return root['@_encoding'] || 'utf8'
} catch {
return 'utf8'
}
}
export default async (url, options = {}) => {

@@ -39,5 +54,6 @@ const {

console.log(contentType)
if (/(\+|\/)(xml|html)/.test(contentType)) {
const arr = contentType.split('charset=')
const charset = arr.length === 2 ? arr[1].trim() : 'utf8'
let charset = arr.length === 2 ? arr[1].trim() : getCharsetFromText(text)
const decoder = new TextDecoder(charset)

@@ -44,0 +60,0 @@ const xml = decoder.decode(buffer)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc