Comment

Comment by dkyc

nodejs, requires node package fetch

Under four seconds, please note that this violates Google's ToS and you will likely be blocked if you do this on any significant scale.

  var bandname = "All Time Low";

  var fetchUrl = require("fetch").fetchUrl;
  var url = "https://www.google.de/search?q=";
  bandname = bandname.replace(" ", "+");

  fetchUrl(url+bandname, {
    headers: {
        'User-Agent' : 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36'
    }
  }, function(error, meta, body){
    var ret = [];
    var alts = body.toString().split('alt\\x3d\\x22');
    alts.forEach(function (alt) { var cur = alt.split("\\x22")[0]; if (cur.indexOf("(")==-1)    ret.push(cur) });
    console.log(ret);
  });
parent dkyc 12 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton