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

google-trends-api-code

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-trends-api-code - npm Package Compare versions

Comparing version 4.9.6 to 4.9.7

2

lib/google-trends-api.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("https"),require("querystring")):"function"==typeof define&&define.amd?define("google-trends-api",["https","querystring"],t):"object"==typeof exports?exports["google-trends-api"]=t(require("https"),require("querystring")):e["google-trends-api"]=t(e.https,e.querystring)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=n(o),a=r(2),s=n(a),u=r(5),c={processor:u.getInterestResults,objectConstructor:u.constructInterestObj},d={processor:u.getTrendingResults,objectConstructor:u.constructTrendingObj},l=i["default"].bind(void 0,s["default"]);t["default"]={autoComplete:l("Auto complete",c),dailyTrends:l("Daily trends",d),interestByRegion:l("Interest by region",c),interestOverTime:l("Interest over time",c),realTimeTrends:l("Real time trends",d),relatedQueries:l("Related queries",c),relatedTopics:l("Related topics",c)},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t,r){var n=r.processor,o=r.objectConstructor,i=n(e);return function(e,r){var n=o(e,r),a=n.cbFunc,s=n.obj;return s instanceof Error?Promise.reject(a(s)):i(t,s).then(function(e){return a(null,e)})["catch"](function(e){return Promise.reject(a(e))})}},e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r=void 0;r=s["default"].request(e,function(e){var r="";e.on("data",function(e){r+=e}),e.on("end",function(){t(null,r.toString("utf8"))})}),r.on("error",function(e){t(e)}),r.end()}function i(e){var t=e.method,r=e.host,n=e.path,i=e.qs,a=e.agent,u={host:r,method:t,path:n+"?"+c["default"].stringify(i)};return a&&(u.agent=a),d&&(u.headers={cookie:d}),new Promise(function(e,t){var r=s["default"].request(u,function(r){var n="";r.on("data",function(e){n+=e}),r.on("end",function(){429===r.statusCode?(d=r.headers["set-cookie"]?r.headers["set-cookie"][0].split(";")[0]:"",u.headers=d?{cookie:d}:{},o(u,function(r,n){return r?t(r):void e(n)})):e(n.toString("utf8"))})});r.on("error",function(e){t(e)}),r.end()})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var a=r(3),s=n(a),u=r(4),c=n(u),d=void 0;e.exports=t["default"]},function(e,t){e.exports=require("https")},function(e,t){e.exports=require("querystring")},function(e,t){"use strict";function r(e,t){return Math.abs(t-e)/864e5<7}function n(e,t,r){var n=(e.getUTCMonth()+1).toString(),o=e.getUTCDate().toString(),i=r?"":"-";n=n.length<2?"0"+n:n,o=r&&o.length<2?"0"+o:o;var a=e.getUTCFullYear().toString(),s=e.getUTCHours(),u=e.getUTCMinutes();return t?""+a+i+n+i+o+"T"+s+"\\:"+u+"\\:00":""+a+i+n+i+o}function o(e){if(e.startTime&&e.endTime&&e.startTime>e.endTime){var t=e.startTime;e.startTime=e.endTime,e.endTime=t}e.endTime||(e.endTime=new Date),e.startTime||(e.startTime=new Date("2004-01-01"));var o=r(e.startTime,e.endTime),i=n(e.startTime,o&&e.granularTimeResolution),a=n(e.endTime,o&&e.granularTimeResolution);return e.time=i+" "+a,e}function i(e){var t=Array.isArray(e.geo)&&Array.isArray(e.keyword);return t&&e.geo.length!==e.keyword.length?new Error("Geo length must be equal to keyword length"):e}function a(e){return!e.startTime||e.startTime instanceof Date||(e=new Error("startTime must be a Date object")),!e.endTime||e.endTime instanceof Date||(e=new Error("endTime must be a Date object")),e}function s(e,t){return e?e&&"object"!==("undefined"==typeof e?"undefined":m(e))||Array.isArray(e)?e=new Error("Must supply an object"):e.keyword||(e=new Error("Must have a keyword field")):e=new Error("Must supply an object"),h(t)&&(e=new Error("Callback function must be a function")),e=i(e),e=a(e)}function u(e,t){"function"==typeof e&&(t=e),e=s(e,t),e.hl||(e.hl="en-US"),e.category||(e.category=0),e.timezone||(e.timezone=(new Date).getTimezoneOffset());var r=["images","news","youtube","froogle",""];return r.indexOf(e.property)===-1&&(e.property=""),t||(t=function(e,t){return e?e:t}),e=o(e),{cbFunc:t,obj:e}}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=["COUNTRY","REGION","CITY","DMA"],r=t.some(function(t){return t===e.toUpperCase()});return r?e.toUpperCase():""}function d(e){try{return JSON.parse(e.slice(4)).widgets}catch(t){throw t.requestBody=e,t}}function l(e){e=Object.assign({},e),delete e.agent;var t=e.geo&&Array.isArray(e.geo),r=Array.isArray(e.keyword);if(t&&!r&&(e.keyword=Array(e.geo.length).fill(e.keyword),r=!0),r){var n=e.keyword.reduce(function(t,r){return t.push(y({},e,{keyword:r})),t},[]);return t&&e.geo.forEach(function(e,t){n[t].geo=e}),n}return[e]}function f(e){return function(t,r){var n={"Auto complete":{path:"/login/trends/api/autocomplete/"+encodeURIComponent(r.keyword)},"Interest over time":{path:"/login/trends/api/widgetdata/multiline",_id:"TIMESERIES"},"Interest by region":{path:"/login/trends/api/widgetdata/comparedgeo",resolution:c(r.resolution),_id:"GEO_MAP"},"Related topics":{path:"/login/trends/api/widgetdata/relatedsearches",_id:"RELATED_TOPICS"},"Related queries":{path:"/login/trends/api/widgetdata/relatedsearches",_id:"RELATED_QUERIES"}},o={method:"GET",host:"z9vyx8l0mg.execute-api.us-east-1.amazonaws.com",path:"/login/trends/api/explore",qs:{hl:r.hl,req:JSON.stringify({comparisonItem:l(r),category:r.category,property:r.property}),tz:r.timezone}};r.agent&&(o.agent=r.agent);var i=n[t],a=i.path,s=i.resolution,u=i._id;return e(o).then(function(n){var o=d(n),i=o.find(function(e){var r=e.id,n=void 0===r?"":r,o=e.request;return n.indexOf(u)>-1||"Auto complete"===t&&o});if(!i){var c={message:"Available widgets does not contain selected api type",requestBody:n};throw c}var l=i.request,f=i.token;s&&(l.resolution=s),l.requestOptions.category=r.category,l.requestOptions.property=r.property,l=JSON.stringify(l);var p={path:a,method:"GET",host:"z9vyx8l0mg.execute-api.us-east-1.amazonaws.com/login",qs:{hl:r.hl,req:l,token:f,tz:r.timezone}};return r.agent&&(p.agent=r.agent),e(p)}).then(function(e){try{var t=JSON.stringify(JSON.parse(e.slice(5)));return t}catch(r){return e}})}}function p(e){return function(t,r){var o={"Daily trends":{path:"/login/trends/api/dailytrends",extraParams:{ed:n(r.trendDate,!1,!0),ns:r.ns}},"Real time trends":{path:"/login/trends/api/realtimetrends",extraParams:{fi:0,fs:0,ri:300,rs:20,sort:0}}},i={method:"GET",host:"z9vyx8l0mg.execute-api.us-east-1.amazonaws.com",path:o[t].path,qs:{hl:r.hl,tz:r.timezone,geo:r.geo,cat:r.category}};return r.agent&&(i.agent=r.agent),i.qs=y({},i.qs,o[t].extraParams),e(i).then(function(e){try{return JSON.stringify(JSON.parse(e.slice(5)))}catch(t){return e}})}}function g(e,t){if("function"==typeof e&&(t=e),!e||e&&"object"!==("undefined"==typeof e?"undefined":m(e))||Array.isArray(e))e=new Error("Must supply an object");else{e.trendDate&&e.trendDate instanceof Date||delete e.trendDate;var r=new Date,n={hl:"en-US",category:"all",timezone:r.getTimezoneOffset(),trendDate:r,ns:15};e=y({},n,e)}return h(t)&&(e=new Error("Callback function must be a function")),e.geo||(e=new Error("Must supply an geographical location (geo)")),t||(t=function(e,t){return e?e:t}),{cbFunc:t,obj:e}}Object.defineProperty(t,"__esModule",{value:!0});var y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.isLessThan7Days=r,t.convertDateToString=n,t.formatTime=o,t.constructInterestObj=u,t.formatResolution=c,t.parseResults=d,t.formatComparisonItems=l,t.getInterestResults=f,t.getTrendingResults=p,t.constructTrendingObj=g;var h=function(e){return!!e&&"function"!=typeof e}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("https"),require("querystring")):"function"==typeof define&&define.amd?define("google-trends-api",["https","querystring"],t):"object"==typeof exports?exports["google-trends-api"]=t(require("https"),require("querystring")):e["google-trends-api"]=t(e.https,e.querystring)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=n(o),a=r(2),s=n(a),u=r(5),c={processor:u.getInterestResults,objectConstructor:u.constructInterestObj},d={processor:u.getTrendingResults,objectConstructor:u.constructTrendingObj},l=i["default"].bind(void 0,s["default"]);t["default"]={autoComplete:l("Auto complete",c),dailyTrends:l("Daily trends",d),interestByRegion:l("Interest by region",c),interestOverTime:l("Interest over time",c),realTimeTrends:l("Real time trends",d),relatedQueries:l("Related queries",c),relatedTopics:l("Related topics",c)},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t,r){var n=r.processor,o=r.objectConstructor,i=n(e);return function(e,r){var n=o(e,r),a=n.cbFunc,s=n.obj;return s instanceof Error?Promise.reject(a(s)):i(t,s).then(function(e){return a(null,e)})["catch"](function(e){return Promise.reject(a(e))})}},e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r=void 0;r=s["default"].request(e,function(e){var r="";e.on("data",function(e){r+=e}),e.on("end",function(){t(null,r.toString("utf8"))})}),r.on("error",function(e){t(e)}),r.end()}function i(e){var t=e.method,r=e.host,n=e.path,i=e.qs,a=e.agent,u={host:r,method:t,path:n+"?"+c["default"].stringify(i)};return a&&(u.agent=a),d&&(u.headers={cookie:d}),new Promise(function(e,t){var r=s["default"].request(u,function(r){var n="";r.on("data",function(e){n+=e}),r.on("end",function(){429===r.statusCode?(d=r.headers["set-cookie"]?r.headers["set-cookie"][0].split(";")[0]:"",u.headers=d?{cookie:d}:{},o(u,function(r,n){return r?t(r):void e(n)})):e(n.toString("utf8"))})});r.on("error",function(e){t(e)}),r.end()})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var a=r(3),s=n(a),u=r(4),c=n(u),d=void 0;e.exports=t["default"]},function(e,t){e.exports=require("https")},function(e,t){e.exports=require("querystring")},function(e,t){"use strict";function r(e,t){return Math.abs(t-e)/864e5<7}function n(e,t,r){var n=(e.getUTCMonth()+1).toString(),o=e.getUTCDate().toString(),i=r?"":"-";n=n.length<2?"0"+n:n,o=r&&o.length<2?"0"+o:o;var a=e.getUTCFullYear().toString(),s=e.getUTCHours(),u=e.getUTCMinutes();return t?""+a+i+n+i+o+"T"+s+"\\:"+u+"\\:00":""+a+i+n+i+o}function o(e){if(e.startTime&&e.endTime&&e.startTime>e.endTime){var t=e.startTime;e.startTime=e.endTime,e.endTime=t}e.endTime||(e.endTime=new Date),e.startTime||(e.startTime=new Date("2004-01-01"));var o=r(e.startTime,e.endTime),i=n(e.startTime,o&&e.granularTimeResolution),a=n(e.endTime,o&&e.granularTimeResolution);return e.time=i+" "+a,e}function i(e){var t=Array.isArray(e.geo)&&Array.isArray(e.keyword);return t&&e.geo.length!==e.keyword.length?new Error("Geo length must be equal to keyword length"):e}function a(e){return!e.startTime||e.startTime instanceof Date||(e=new Error("startTime must be a Date object")),!e.endTime||e.endTime instanceof Date||(e=new Error("endTime must be a Date object")),e}function s(e,t){return e?e&&"object"!==("undefined"==typeof e?"undefined":m(e))||Array.isArray(e)?e=new Error("Must supply an object"):e.keyword||(e=new Error("Must have a keyword field")):e=new Error("Must supply an object"),h(t)&&(e=new Error("Callback function must be a function")),e=i(e),e=a(e)}function u(e,t){"function"==typeof e&&(t=e),e=s(e,t),e.hl||(e.hl="en-US"),e.category||(e.category=0),e.timezone||(e.timezone=(new Date).getTimezoneOffset());var r=["images","news","youtube","froogle",""];return r.indexOf(e.property)===-1&&(e.property=""),t||(t=function(e,t){return e?e:t}),e=o(e),{cbFunc:t,obj:e}}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=["COUNTRY","REGION","CITY","DMA"],r=t.some(function(t){return t===e.toUpperCase()});return r?e.toUpperCase():""}function d(e){try{return JSON.parse(e.slice(4)).widgets}catch(t){throw t.requestBody=e,t}}function l(e){e=Object.assign({},e),delete e.agent;var t=e.geo&&Array.isArray(e.geo),r=Array.isArray(e.keyword);if(t&&!r&&(e.keyword=Array(e.geo.length).fill(e.keyword),r=!0),r){var n=e.keyword.reduce(function(t,r){return t.push(y({},e,{keyword:r})),t},[]);return t&&e.geo.forEach(function(e,t){n[t].geo=e}),n}return[e]}function f(e){return function(t,r){var n={"Auto complete":{path:"/login/trends/api/autocomplete/"+encodeURIComponent(r.keyword)},"Interest over time":{path:"/login/trends/api/widgetdata/multiline",_id:"TIMESERIES"},"Interest by region":{path:"/login/trends/api/widgetdata/comparedgeo",resolution:c(r.resolution),_id:"GEO_MAP"},"Related topics":{path:"/login/trends/api/widgetdata/relatedsearches",_id:"RELATED_TOPICS"},"Related queries":{path:"/login/trends/api/widgetdata/relatedsearches",_id:"RELATED_QUERIES"}},o={method:"GET",host:"z9vyx8l0mg.execute-api.us-east-1.amazonaws.com",path:"/login/trends/api/explore",qs:{hl:r.hl,req:JSON.stringify({comparisonItem:l(r),category:r.category,property:r.property}),tz:r.timezone}};r.agent&&(o.agent=r.agent);var i=n[t],a=i.path,s=i.resolution,u=i._id;return e(o).then(function(n){var o=d(n),i=o.find(function(e){var r=e.id,n=void 0===r?"":r,o=e.request;return n.indexOf(u)>-1||"Auto complete"===t&&o});if(!i){var c={message:"Available widgets does not contain selected api type",requestBody:n};throw c}var l=i.request,f=i.token;s&&(l.resolution=s),l.requestOptions.category=r.category,l.requestOptions.property=r.property,l=JSON.stringify(l);var p={path:a,method:"GET",host:"z9vyx8l0mg.execute-api.us-east-1.amazonaws.com",qs:{hl:r.hl,req:l,token:f,tz:r.timezone}};return r.agent&&(p.agent=r.agent),e(p)}).then(function(e){try{var t=JSON.stringify(JSON.parse(e.slice(5)));return t}catch(r){return e}})}}function p(e){return function(t,r){var o={"Daily trends":{path:"/login/trends/api/dailytrends",extraParams:{ed:n(r.trendDate,!1,!0),ns:r.ns}},"Real time trends":{path:"/login/trends/api/realtimetrends",extraParams:{fi:0,fs:0,ri:300,rs:20,sort:0}}},i={method:"GET",host:"z9vyx8l0mg.execute-api.us-east-1.amazonaws.com",path:o[t].path,qs:{hl:r.hl,tz:r.timezone,geo:r.geo,cat:r.category}};return r.agent&&(i.agent=r.agent),i.qs=y({},i.qs,o[t].extraParams),e(i).then(function(e){try{return JSON.stringify(JSON.parse(e.slice(5)))}catch(t){return e}})}}function g(e,t){if("function"==typeof e&&(t=e),!e||e&&"object"!==("undefined"==typeof e?"undefined":m(e))||Array.isArray(e))e=new Error("Must supply an object");else{e.trendDate&&e.trendDate instanceof Date||delete e.trendDate;var r=new Date,n={hl:"en-US",category:"all",timezone:r.getTimezoneOffset(),trendDate:r,ns:15};e=y({},n,e)}return h(t)&&(e=new Error("Callback function must be a function")),e.geo||(e=new Error("Must supply an geographical location (geo)")),t||(t=function(e,t){return e?e:t}),{cbFunc:t,obj:e}}Object.defineProperty(t,"__esModule",{value:!0});var y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.isLessThan7Days=r,t.convertDateToString=n,t.formatTime=o,t.constructInterestObj=u,t.formatResolution=c,t.parseResults=d,t.formatComparisonItems=l,t.getInterestResults=f,t.getTrendingResults=p,t.constructTrendingObj=g;var h=function(e){return!!e&&"function"!=typeof e}}])});
//# sourceMappingURL=google-trends-api.min.js.map
{
"name": "google-trends-api-code",
"version": "4.9.6",
"version": "4.9.7",
"description": "an API layer on top of google trends",

@@ -5,0 +5,0 @@ "main": "lib/google-trends-api.min.js",

@@ -283,3 +283,3 @@ 'use strict';

method: 'GET',
host: 'z9vyx8l0mg.execute-api.us-east-1.amazonaws.com/login',
host: 'z9vyx8l0mg.execute-api.us-east-1.amazonaws.com',
// host: 'trends.google.com',

@@ -286,0 +286,0 @@ qs: {

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