Socket
Socket
Sign inDemoInstall

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 2.3.7 to 2.3.8

8

app.js

@@ -6,3 +6,4 @@ var request = require('request'),

url = require('url'),
_ = require('lodash');
_ = require('lodash'),
jschardet = require('jschardet');

@@ -448,4 +449,5 @@ module.exports = function (options, callback) {

if (options.encoding === null) {
if (charset(response.headers, body, peekSize)) {
body = iconv.decode(body, charset(response.headers, body, peekSize));
var char = charset(response.headers, body, peekSize) || jschardet.detect(body).encoding;
if (char) {
body = iconv.decode(body, char);
} else {

@@ -452,0 +454,0 @@ body = body.toString();

{
"name": "open-graph-scraper",
"description": "Node.js scraper service for Open Graph info",
"version": "2.3.7",
"version": "2.3.8",
"license": "MIT",

@@ -19,2 +19,3 @@ "main": "app.js",

"iconv-lite": "0.4.13",
"jschardet": "1.4.1",
"lodash": "4.16.4",

@@ -21,0 +22,0 @@ "request": "2.75.0"

@@ -132,2 +132,8 @@ var app = require('../app'),

// test for legacy with no charset
var optionCharset3 = {
'url': 'http://www.f2.dion.ne.jp/~initialt/errdiffusion.html',
'encoding': null
};
describe('GET OG', function () {

@@ -368,3 +374,3 @@ this.timeout(10000); // should wait at least ten seconds before failing

expect(result.data.twitterDescription).to.be('The Twitter platform connects your website or application with the worldwide conversation happening on Twitter.');
expect(result.data.twitterImage.url).to.be('https://ton.twimg.com/dtc/f1d20a4e-7c91-40cd-8dc0-7e2b46e56d55/_static/imgs/twitterdev_gear.png');
expect(result.data.twitterImage.url).to.be('https://ton.twimg.com/dtc/8504dc03-f045-49a7-bf81-7aa8b104c088/_static/imgs/twitterdev_gear.png');
expect(result.data.ogSiteName).to.be('Twitter Developers');

@@ -374,3 +380,3 @@ expect(result.data.ogTitle).to.be('Twitter Developers');

expect(result.data.ogType).to.be('website');
expect(result.data.ogImage.url).to.be('https://ton.twimg.com/dtc/f1d20a4e-7c91-40cd-8dc0-7e2b46e56d55/_static/imgs/twitterdev_gear.png');
expect(result.data.ogImage.url).to.be('https://ton.twimg.com/dtc/8504dc03-f045-49a7-bf81-7aa8b104c088/_static/imgs/twitterdev_gear.png');
done();

@@ -386,3 +392,3 @@ });

expect(result.data.ogTitle).to.be('Build software better, together');
expect(result.data.ogDescription).to.be('GitHub is where people build software. More than 18 million people use GitHub to discover, fork, and contribute to over 48 million projects.');
expect(result.data.ogDescription).to.be.a('string');
expect(result.data.ogImage.url).to.be('https://assets-cdn.github.com/images/modules/open_graph/github-logo.png');

@@ -398,3 +404,3 @@ expect(result.data.ogImage.width).to.be('1200');

expect(result.data.twitterTitle).to.be('GitHub');
expect(result.data.twitterDescription).to.be('GitHub is where people build software. More than 18 million people use GitHub to discover, fork, and contribute to over 48 million projects.');
expect(result.data.twitterDescription).to.be.a('string');
expect(result.data.twitterImage.url).to.be('https://assets-cdn.github.com/images/modules/open_graph/github-logo.png');

@@ -449,2 +455,10 @@ expect(result.data.twitterImage.width).to.be('1200');

});
it('Valid Call - legacy no charset - Should Return correct Open Graph Info + charset info', function (done) {
app(optionCharset3, function (err, result) {
expect(err).to.be(false);
expect(result.success).to.be(true);
expect(result.data.ogTitle).to.be('誤差拡散とは');
done();
});
});
});
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