Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

open-graph-scraper

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

open-graph-scraper - npm Package Compare versions

Comparing version 6.2.0 to 6.2.1

4

CHANGELOG.md
# Change Log
## 6.2.1
- Send back more details when there is a server error
## 6.2.0

@@ -4,0 +8,0 @@

4

dist/lib/openGraphScraper.js

@@ -25,3 +25,3 @@ "use strict";

}
const formattedUrl = (0, utils_1.validateAndFormatURL)(options.url, (options.urlValidatorSettings || utils_1.defaultUrlValidatorSettings));
const formattedUrl = (0, utils_1.validateAndFormatURL)(options.url || '', (options.urlValidatorSettings || utils_1.defaultUrlValidatorSettings));
if (!formattedUrl.url)

@@ -34,3 +34,3 @@ throw new Error('Invalid URL');

// eslint-disable-next-line max-len
if (options.blacklist && options.blacklist.some((blacklistedHostname) => options.url.includes(blacklistedHostname))) {
if (options.blacklist && options.blacklist.some((blacklistedHostname) => options.url?.includes(blacklistedHostname))) {
throw new Error('Host name has been black listed');

@@ -37,0 +37,0 @@ }

@@ -15,3 +15,3 @@ "use strict";

try {
response = await (0, undici_1.fetch)(options.url, {
response = await (0, undici_1.fetch)(options.url || '', {
signal: AbortSignal.timeout((options.timeout || 10) * 1000),

@@ -26,3 +26,26 @@ headers: { Origin: options.url },

if (response && response.status && (response.status.toString().substring(0, 1) === '4' || response.status.toString().substring(0, 1) === '5')) {
throw new Error('Server has returned a 400/500 error code');
switch (response.status) {
case 400:
throw new Error('400 Bad Request');
case 401:
throw new Error('401 Unauthorized');
case 403:
throw new Error('403 Forbidden');
case 404:
throw new Error('404 Not Found');
case 408:
throw new Error('408 Request Timeout');
case 410:
throw new Error('410 Gone');
case 500:
throw new Error('500 Internal Server Error');
case 502:
throw new Error('502 Bad Gateway');
case 503:
throw new Error('503 Service Unavailable');
case 504:
throw new Error('504 Gateway Timeout');
default:
throw new Error('Server has returned a 400/500 error code');
}
}

@@ -29,0 +52,0 @@ if (body === undefined || body === '') {

{
"name": "open-graph-scraper",
"description": "Node.js scraper module for Open Graph and Twitter Card info",
"version": "6.2.0",
"version": "6.2.1",
"license": "MIT",

@@ -54,3 +54,3 @@ "main": "./dist/index.js",

"nyc": "^15.1.0",
"sinon": "^15.1.2",
"sinon": "^15.2.0",
"ts-mocha": "^10.0.0",

@@ -57,0 +57,0 @@ "typescript": "^5.1.3"

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