Comparing version 1.6.1 to 1.6.2
@@ -12,3 +12,3 @@ "use strict"; | ||
exports.getResponse = getResponse; | ||
exports.default = void 0; | ||
exports.default = exports.parseGoogleSearchResultUrl = void 0; | ||
@@ -28,2 +28,4 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var querystring = require('querystring'); | ||
var cheerio = require('cheerio'); | ||
@@ -100,2 +102,16 @@ | ||
var parseGoogleSearchResultUrl = function parseGoogleSearchResultUrl(url) { | ||
if (!url) { | ||
return undefined; | ||
} | ||
if (url.charAt(0) === '/') { | ||
return querystring.parse(url).url; | ||
} | ||
return url; | ||
}; | ||
exports.parseGoogleSearchResultUrl = parseGoogleSearchResultUrl; | ||
function getResults(_ref) { | ||
@@ -128,3 +144,3 @@ var data = _ref.data, | ||
results[index] = Object.assign(results[index], { | ||
link: elem.attribs.href | ||
link: parseGoogleSearchResultUrl(elem.attribs.href) | ||
}); | ||
@@ -131,0 +147,0 @@ } |
@@ -67,5 +67,5 @@ "use strict"; | ||
var titleSelector = 'div.tF2Cxc > div:nth-child(1) > a > h3'; | ||
var linkSelector = 'div.tF2Cxc > div:nth-child(1) > a'; | ||
var snippetSelector = 'div.tF2Cxc > div:nth-child(2) > div > span'; | ||
var titleSelector = 'div.ZINbbc > div:nth-child(1) > a > h3'; | ||
var linkSelector = 'div.ZINbbc > div:nth-child(1) > a'; | ||
var snippetSelector = '#main > div > div > div > div:not(.v9i61e) > div.AP7Wnd'; | ||
var resultStatsSelector = '#resultStats'; | ||
@@ -72,0 +72,0 @@ var cursorSelector = '#nav > tbody > tr > td.cur'; |
{ | ||
"name": "google-it", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "A CLI and Node.js library to help retrieve, display, and store Google search results", | ||
@@ -5,0 +5,0 @@ "main": "./lib/main.js", |
@@ -5,2 +5,3 @@ /* eslint-disable no-console */ | ||
const fs = require('fs'); | ||
const querystring = require('querystring'); | ||
const cheerio = require('cheerio'); | ||
@@ -70,2 +71,12 @@ require('colors'); | ||
export const parseGoogleSearchResultUrl = (url) => { | ||
if (!url) { | ||
return undefined; | ||
} | ||
if (url.charAt(0) === '/') { | ||
return querystring.parse(url).url; | ||
} | ||
return url; | ||
}; | ||
export function getResults({ | ||
@@ -97,3 +108,3 @@ data, | ||
results[index] = Object.assign(results[index], { | ||
link: elem.attribs.href, | ||
link: parseGoogleSearchResultUrl(elem.attribs.href), | ||
}); | ||
@@ -100,0 +111,0 @@ } |
@@ -54,5 +54,5 @@ /* eslint-disable no-extra-parens */ | ||
const titleSelector = 'div.tF2Cxc > div:nth-child(1) > a > h3'; | ||
const linkSelector = 'div.tF2Cxc > div:nth-child(1) > a'; | ||
const snippetSelector = 'div.tF2Cxc > div:nth-child(2) > div > span'; | ||
const titleSelector = 'div.ZINbbc > div:nth-child(1) > a > h3'; | ||
const linkSelector = 'div.ZINbbc > div:nth-child(1) > a'; | ||
const snippetSelector = '#main > div > div > div > div:not(.v9i61e) > div.AP7Wnd'; | ||
const resultStatsSelector = '#resultStats'; | ||
@@ -59,0 +59,0 @@ const cursorSelector = '#nav > tbody > tr > td.cur'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40006
955