function getTrendingResults(request) {
  return (searchType, obj) => {
    const searchTypeMap = {
      'Daily trends': {
        path: '/trends/api/dailytrends',
        extraParams: {
          ed: convertDateToString(obj.trendDate, false, true),
          ns: obj.ns,
        },
      },
      'Real time trends': {
        path: '/trends/api/realtimetrends',
        extraParams: {
          fi: 0,
          fs: 0,
          ri: 300, // # of trending stories IDs returned
          rs: 20,
          sort: 0,
        },
      },
    };

    const options = {
      method: 'GET',
      host: 'trends.google.com',
      path: searchTypeMap[searchType].path,
      qs: {
        hl: obj.hl,
        tz: obj.timezone,
        geo: obj.geo,
        cat: obj.category,
      },
    };

    if (obj.agent) options.agent = obj.agent;

    options.qs = {...options.qs, ...searchTypeMap[searchType].extraParams};

    return request(options)
    .then((res) => {
      try {
        /** JSON.parse will decode unicode */
        return JSON.stringify(JSON.parse(res.slice(5)));
      } catch (e) {
        /** throws if not valid JSON, so just return unaltered res string */
        return res;
      }
    });
  };
}
throws if not valid JSON, so just return unaltered res string