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

async-g-i-s

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-g-i-s - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

index.d.ts

48

index.js

@@ -16,3 +16,3 @@ const cheerio = require('cheerio');

* @param {[String]} filterOutDomains Not looking for these domains
* @returns {Promise<[Result]>} Array of results
* @returns {Promise<[Object]>} Array of results
*/

@@ -25,5 +25,3 @@ async function gis(searchTerm, queryStringAddition = "", filterOutDomains = ['gstatic.com']) {

const url = `${baseURL}?tbm=isch&q=${searchTerm}${queryStringAddition}`
const body = await fetch(url, {
const body = await fetch(`${baseURL}?tbm=isch&q=${searchTerm}${queryStringAddition}`, {
headers: {

@@ -57,13 +55,17 @@ 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'

while ((result = regex.exec(content)) !== null) {
while ((result = regex.exec(content)) !== null)
if (result.length > 3) {
const ref = new Result(result[1], +result[2], +result[3]);
const ref = {
url: result[1],
height: +result[2],
width: +result[3]
}
if (filterOutDomains.every(skipDomain => ref.url.indexOf(skipDomain) === -1))
if (filterOutDomains.every(skipDomain => !ref.url.includes(skipDomain)))
results.push(ref);
}
}
return results;

@@ -78,32 +80,2 @@

/**
* Image search result class
*/
class Result {
/**
* Image search result
* @param {String} url Image URL
* @param {Number} height
* @param {Number} width
*/
constructor(url, height, width) {
/**
* Image URL
*/
this.url = url;
/**
* Image height
*/
this.height = height;
/**
* Image width
*/
this.width = width;
}
}
module.exports = gis;
{
"name": "async-g-i-s",
"version": "1.0.0",
"version": "1.1.0",
"description": "Async Google Image Search",
"main": "index.js",
"scripts": {
"test": "node ./tests/test"
"test": "node test"
},
"types": "index.d.ts",
"repository": {

@@ -13,3 +14,7 @@ "type": "git",

},
"keywords": [],
"keywords": [
"google",
"image",
"search"
],
"author": "Akif9748",

@@ -16,0 +21,0 @@ "license": "MIT",

@@ -0,0 +0,0 @@ # async-g-i-s

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