So I thought I'd write an apps-script macro to help find Twitter profiles of my G+ circled people. [I'm assuming these contacts will go away on April 2nd, right Greg Wolfe ?]
Code works, but App Script barfs on the Twitter javascript used to render the follow buttons. So I just grabbed the html output and stuck it on a server and clicked the follow bu
tton...
If someone wants to poke at it and/or publish it (I have no time for either) have at it...
You can access it here:
And the xss-riddled code looks like this:
function doGet() {
var html = '<!DOCTYPE html>';
do {
var pageToken;
var connections = People.People.Connections.list('people/me', {
pageSize: 100,
personFields: 'names,urls',
pageToken: pageToken
});
connections.connections.forEach(function(person) {
// Skip people without URLs in their profile.
if (!person.urls) {
return;
}
person.urls.forEach(function(url) {
if (url.value && url.value.match(/twitter.com/)) {
var name = url.value;
if (person.names && person.names.length > 0) {
name = person.names[0].displayName;
}
html += '\n<br><a class="twitter-follow-button" href="' + url.value + '">';
html += 'Follow ' + name + '</a>\n';
}
});
});
pageToken = connections.nextPageToken;
} while (pageToken);
html += '\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'
var output = HtmlService.createHtmlOutput(html);
output.setTitle('Google+ Follower Finder');
return output;
}