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.0.5 to 2.0.6

5

app.js

@@ -176,2 +176,5 @@ var request = require('request'),

options.timeout = inputTimeout;
options.headers = {
'user-agent': 'request.js'
};
that.getOG(options, function (err, results) {

@@ -268,3 +271,3 @@ if (results) {

callback(err, null);
} else if ( response.statusCode !== 200 ) {
} else if (response && response.statusCode && (response.statusCode.toString().substring(0, 1) === '4' || response.statusCode.toString().substring(0, 1) === '5')) {
callback(new Error('Error from server'), null);

@@ -271,0 +274,0 @@ } else {

2

package.json
{
"name": "open-graph-scraper",
"description": "Node.js scraper service for Open Graph info",
"version": "2.0.5",
"version": "2.0.6",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "app.js",

@@ -66,6 +66,9 @@ var app = require('../app'),

'url': 'this is a testt'
},
options15 = {
'url': 'https://github.com/jshemas/notOpenGraphScraper'
};
// test getting only open graph tags
var options15 = {
var options16 = {
'url': 'http://www.wikipedia.org/',

@@ -76,9 +79,10 @@ 'onlyGetOpenGraphInfo': true

// test getting the description from meta tags
var options16 = {
'url': 'https://twitter.com/',
var options17 = {
'url': 'https://twitter.com/'
}
var options17 = {
'url': 'https://github.com/jshemas/notOpenGraphScraper'
};
// testing 304 page
var options18 = {
'url': 'http://www.wemeanbusinesslondon.com/blog/2016/5/10/the-entrepreneur-spiration-series-going-nuts-for-pip-nut'
}

@@ -236,3 +240,3 @@ // test videos

it('Invalid Call - response code is 404', function (done) {
app(options17, function (err, result) {
app(options15, function (err, result) {
expect(err).to.be(true);

@@ -245,3 +249,3 @@ expect(result.success).to.be(false);

it('Valid Call - only get open graph info', function (done) {
app(options15, function (err, result) {
app(options16, function (err, result) {
expect(err).to.be(false);

@@ -254,3 +258,3 @@ expect(result.success).to.be(true);

it('Valid Call - test getting the description from meta tags', function (done) {
app(options16, function (err, result) {
app(options17, function (err, result) {
expect(err).to.be(false);

@@ -263,2 +267,10 @@ expect(result.success).to.be(true);

});
it('Valid Call - testing 304 page', function (done) {
app(options18, function (err, result) {
expect(err).to.be(false);
expect(result.success).to.be(true);
expect(result.data.ogTitle).to.be('The Entrepreneur-spiration Series: Going nuts for Pip & Nut');
done();
});
});
it('Valid Call - Test Youtube Video - Should Return correct Open Graph Info', function (done) {

@@ -283,3 +295,3 @@ app(optionsYoutube, function (err, result) {

app(optionsTwitch, function (err, result) {
console.log('result', result);
// console.log('result', result);
expect(err).to.be(false);

@@ -286,0 +298,0 @@ expect(result.success).to.be(true);

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