Skip to content

Instantly share code, notes, and snippets.

@qubodup
Created June 19, 2024 11:36
Show Gist options
  • Save qubodup/c67755581d9bf5dbc665f8ad939bd2ec to your computer and use it in GitHub Desktop.
Save qubodup/c67755581d9bf5dbc665f8ad939bd2ec to your computer and use it in GitHub Desktop.
Scrape Google results page to csv (tsv, tab separated) userscript only link and title
// https://stackoverflow.com/a/26573281/188159
javascript: (function (){
function l(u, i) {
var d = document;
if (!d.getElementById(i)) {
var s = d.createElement('script');
s.src = u;
s.id = i;
d.body.appendChild(s);
}
} l('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', 'jquery')
})();
let all = '';
let counter = 0;
$('h3').each(function(){
counter += 1;
let title = $(this).text();
let link = $(this).parent().attr('href');
all += title + '\t' + link + '\n';
});
console.log(all);
console.log(counter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment