Commit bfb201a9 authored by insert's avatar insert 🎺

Fix for Google Contacts updates, v1.2.

parent 13d15786
// ==UserScript==
// @name Google Contacts Scraper
// @namespace https://insrt.uk
// @version 1.1
// @version 1.2
// @description scrapes contacts from a given page
// @author insert
// @match https://contacts.google.com/*
......@@ -18,7 +18,7 @@
* 1. Go to Google Contacts
* 2. Run script
* 3. Collect data by scrolling and loading all contacts
* 4. Press button at the top of the site
* 4. Press button at the top of the site (or access window.scraper)
*/
......@@ -28,7 +28,6 @@ let pfp = {};
document.onreadystatechange = function () {
if (document.readyState === "complete") {
(() => {
var targetNode = document.querySelector("#yDmH0d");
var observerOptions = {
childList: true,
......@@ -46,10 +45,7 @@ document.onreadystatechange = function () {
if (p.startsWith('\t')) p = p.substring(1);
let r = p.split('\t');
set[r[0]] = r[1];
} else if (x.className == "KEUMte") {
let u = x.childNodes[0].childNodes[0].childNodes[0].childNodes[0].src;
let n = x.parentElement.childNodes[1].childNodes[0].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].innerText;
pfp[n] = u;
pfp[r[0]] = x.childNodes[0].childNodes[0].childNodes[1].src;
}
});
break;
......@@ -65,8 +61,8 @@ document.onreadystatechange = function () {
function collect() {
let d = new Date();
return JSON.stringify({
_comment: "Generated using Google Contacts scraper script [v1].",
year: d.getMonth() > 7,
_comment: "Generated using Google Contacts scraper script [v1.2].",
timestamp: +d,
generated: '' + d,
data: set
});
......@@ -75,8 +71,8 @@ document.onreadystatechange = function () {
function cpfp() {
let d = new Date();
return JSON.stringify({
_comment: "PFP URLs",
year: d.getMonth() > 7,
_comment: "PFP URLs generated using Google Contacts scraper script [v1.2].",
timestamp: +d,
generated: '' + d,
data: pfp
});
......@@ -91,7 +87,7 @@ document.onreadystatechange = function () {
console.log(collect());
return false;
});
document.querySelector('.gb_ne').append(el);
document.querySelector('.gb_0e').append(el);
})();
......@@ -103,7 +99,7 @@ document.onreadystatechange = function () {
console.log(cpfp());
return false;
});
document.querySelector('.gb_ne').append(el);
document.querySelector('.gb_0e').append(el);
})();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment