• Stars
    star
    175
  • Rank 218,059 (Top 5 %)
  • Language
    JavaScript
  • License
    Other
  • Created about 13 years ago
  • Updated almost 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Unofficial Google+ Read/Write Extension API

An Unofficial Google+ JavaScript API

It has been 6 months since we have seen any Circle/Posts/Followers Write/Read API for Google+. Since Google+ is by nature asynchronous we could tap into their XHR calls and imitate the requests.

Who uses this API:

My Hangouts Chrome Extension https://plus.google.com/116935358560979346551/about

Circle Management Chrome Extension https://plus.google.com/100283465826629314254/about

Map My Circles for Google+â„¢ https://chrome.google.com/webstore/detail/mcfifkeppchbjlepfbepfhjpkhfalcoa

Nuke Comments on Google+ https://chrome.google.com/webstore/detail/nfgaadooldinkdjpjbnbgnoaepmajdfh

Do Share on Google+ https://chrome.google.com/webstore/detail/oglhhmnmdocfhmhlekfdecokagmbchnf

Who made this:

Core Contributors

Contributors

  • Jingqin Lynn (Contributed newPost)
  • Ryan Peggs (Contributed Bug fixes)

What is it about:

I provide you a very basic asynchronous Google+ API, in the current release, you can do the following:

  • Create, Modify, Sort, Query, Remove Circles
  • Query, Modify your Profile Information
  • Add, Remove, Move People from and to Circles
  • Real-Time Search
  • Lookup Posts, Manage comments by reporting and deleting.

This is a fully read and write API.

Native Examples:

// Create an instance of the API.
var plus = new GooglePlusAPI();

// Initialize the API so we could get a new session if it exists we reuse it.
plus.init();

// Refresh your circle information.
plus.refreshCircles(function() {

   // Let us see who added me to their circle.
   plus.getPeopleWhoAddedMe(function(people) {
     console.log(people);
   });

   // Let us see who is in my circles.
   plus.getPeopleInMyCircles(function(people) {
     console.log(people);
   });

   // Let us see who is in our circles but didn't add us to theirs.
   plus.getDatabase().getPersonEntity().find({in_my_circle: 'Y', added_me: 'N'}, function(people) {
     console.log(people);
   });
});

As you see, it is pretty easy to query everything. The possibilities are inifinite since the data is backed up in a WebSQL DataStore, so querying, reporting, etc, would be super quick.

If you want to place that in an extension, I have created a bridge, so you can use this in a content script context and extension context safely. To do so, you send a message as follows:

// Initialize the API so we get the authorization token.
chrome.extension.sendRequest({method: 'PlusAPI', data: {service: 'Plus', method: 'init'}}, function(initResponse) {
  chrome.extension.sendRequest({method: 'PlusAPI', data: {service: 'Plus', method: 'refreshCircles'}}, function() {
    // etc ... The method is the same method we defined previously in the raw example.
  });
});

Another example, lets say we want to search for a hash tag:

// Initialize the Google Plus API Wrapper.
var api = new GooglePlusAPI();

// Lets initialize it so we can get the current logged in users session.
api.init();

// Search for the API. You have the following enums to choose from for searching:
//
//   GooglePlusAPI.SearchType.EVERYTHING
//   GooglePlusAPI.SearchType.PEOPLE_PAGES;
//   GooglePlusAPI.SearchType.POSTS
//   GooglePlusAPI.SearchType.SPARKS
//   GooglePlusAPI.SearchType.HANGOUTS
//   GooglePlusAPI.SearchType.HASHTAGS
//
// So lets search for hashtags that have Microsoft inside them.
api.search(function(resp) {
  console.log("Hash results for Microsoft: " + resp.data.join(", "));
}, "microsoft", { type: GooglePlusAPI.SearchType.HASHTAGS });

A full blown example will be released by the end of this week showing how powerful this could be. As you already know, I am creating a simple circle management utility so you can manage your circles.

API Documentation

AbstractEntity Members:

  • String getName() - The table name that this entity holds.
  • void tableDefinition() - Abstract method that you override to describe the table.
  • void initialize() - Private method that creates the DDL to execute from tableDefinition
  • void drop(Function:doneCallback) - Drops the table from cache including the definition.
  • void clear(Function:doneCallback) - Removes all rows from the table, keeps the definition.
  • void create(Object[]:obj, Function<Object{status, data}>:callback) - Inserts object(s) into the table.
  • void destroy(String[]:id, Function<Object{status, data}>:callback) - Deletes object(s) into the table.
  • void update(Object[]:obj, Function<Object{status, data}>:callback) - Updates object(s) into the table.
  • void find(Object:obj, Function<Object{status, data}>:callback) - Find a specific object(s) in the table.
  • void findAll(Function<Object{status, data}>:callback) - Queries for everthing, all the data.
  • void count(Object:obj, Function<Object{status, data}>:callback) - Counts the number of rows in the table.
  • void save(Object[]:obj, Function<Object{status, data}>:callback) - Updates otherwise it creates.

PlusDB Entities:

  • void open() - Opens the database
  • void clearAll(Function:doneCallback) - Drops all tables from the database.
  • AbstractEntity getPersonEntity() - Returns the PersonEntity
  • AbstractEntity getCircleEntity() - Returns the CircleEntity
  • AbstractEntity getPersonCircleEntity() - Returns the PersonCircleEntity

Native querying:

  • PlusDB getDatabase() - Returns the native Database to do advanced queries

Initialization, fill up the database:

  • void init(Function:doneCallback) - Initializes session and data, you can call it at app start.
  • void refreshCircles(Function:doneCallback, boolean:opt_onlyCircles) - Queries G+ Service for all circles and people information.
  • void refreshFollowers(Function:doneCallback) - Queries G+ Service for everyone who is following me.
  • void refreshFindPeople(Function:doneCallback) - Queries G+ Services for discovering similar people like me.
  • void refreshInfo(Function:doneCallback(data)) - Refresh my information. Rarely used.

Persistence:

  • void addPeople(Function:doneCallback, String:circleName, Array<String>:usersToAdd) - Adding people to a circle.
  • void removePeople(Function:doneCallback, String:circleName, Array<String>:usersToRemove) - Removing people from a circle
  • void createCircle(Function:doneCallback, String:circleName, String:optionalDescription) - Creating a circle.
  • void removeCircle(Function:doneCallback, String:circleID) - Removing a circle.
  • void sortCircle(Function:doneCallback, String:circleID, Number:index) - Sort a circle to the given index, G+ will deal with the order
  • void modifyCircle(Function:doneCallback, String:circleID, String:optionalName, String:optionalDescription) - Modifying circle meta.
  • void modifyBlocked(Function:doneCallback, Array<String>:usersToModify, boolean:opt_block) - Modify the blocked state of people. Allows blocking and unblocking.
  • void modifyMute(Function:doneCallback, String:activityID, Boolean:muteStatus) - Sets the mute status for a specific item.
  • void modifyLockPost(Function:doneCallback, String:activityID, Boolean:toLock) - Sets the mute status for a specific item.
  • void modifyDisableComments(Function:doneCallback, String:activityID, Boolean:toDisable) - Sets the mute status for a specific item.
  • void addComment(Function:doneCallback, String: postId, String: content) - Adds a comment.
  • void deleteComment(Function:doneCallback, String:commentId) - Deleting a comment.
  • void deleteActivity(Function:doneCallback, String:activityId) - Deleting a post.
  • void saveProfile(Function:doneCallback, String:introduction) - Save a new introduction.
  • void reportProfile(Function:doneCallback, String:userId, opt_abuseReason) - Report an abusive profile.
  • void newPost(Function:doneCallback, String:content) - Creates a new post on the stream.
  • void fetchLinkMedia(Function:doneCallback(data), String:url - Fetches media items describing a URL such as images, title and description.

Read:

  • boolean isAuthenticated()
  • void getProfile(Function({introduction}):callback, String:googleProfileID)
  • void getInfo(Function({id, name, email, acl}:callback)
  • void getCircles(Function(CircleEntity[]):callback)
  • void getCircle(Function(String:circleID, CircleEntity):callback)
  • void getPeople(Object:obj, Function(PersonEntity[]):callback)
  • void getPerson(Function(String:googleProfileID, PersonEntity):callback)
  • void getPeopleInMyCircles(Function(PersonEntity[]):callback)
  • void getPersonInMyCircles(String:googleProfileID, Function(PersonEntity):callback)
  • void getPeopleWhoAddedMe(Function(PersonEntity[]):callback)
  • void getPersonWhoAddedMe(String:googleProfileID, Function(PersonEntity):callback)
  • void search(Function(data):callback, String:query, Object:{category, precache, burst, burst_size})
  • void lookupUsers(Function(data):callback, Array<String:googleProfileID>)
  • void lookupPost(Function(data):callback, String:googleProfileID, String:postProfileID)
  • void lookupActivities(Function(data):callback, String:circleID, String:personID, String:pageToken)
  • void getPages(Function(data):callback)
  • void getCommunities(Function(data):callback)
  • void getCommunity(Function(data):callback, String:communityId)

Private Members (only for internal API):

  • Object _parseJSON(String:input) - Parses the Google Irregular JSON
  • XMLHttpRequest _requestService(Function:callback, String:url, String:postData - Sends an XHR request to Google Service
  • String _getSession()- Unique user session that authenticates to persist to your account.

Watch this space!

More Repositories

1

ethereum-burn-stats

Website that showcases EIP-1559 Burn
TypeScript
186
star
2

fb-exporter

Facebook Friend Exporter Chrome Extension
JavaScript
149
star
3

extended-share-extension

Extends the Google+ Share to many other Social Networks!
JavaScript
103
star
4

reload-all-tabs-extension

Reload All Tabs Google Chrome Extension
JavaScript
80
star
5

prayer-times-extension

Under Development: Prayer Time Calculation based on Geolocation for Chromium and Firefox
TypeScript
64
star
6

hangout-codepad-extension

Code Collaboration over a hangout on Google+ tapping into Wave technology!
JavaScript
52
star
7

my-hangouts-extension

My Hangouts for Google Plus Chrome Extension
JavaScript
35
star
8

3mail

Implementing a decentralized email on the blockchain using Secure IPFS as message channels and ENS as the DID address resolutions!
TypeScript
26
star
9

proxy-anywhere-extension

Proxy Server Anywhere Google Chrome Extension allows you to instantaneously change to your custom proxy from a click of a button.
JavaScript
21
star
10

labs-for-google-plus

Framework for integrating small labs for Google+ into a single Chrome Extension
JavaScript
19
star
11

fblock

AdBlocker for Facebook
JavaScript
14
star
12

OTRLib

Off The Record (OTR) protocol library in C# for Windows Runtime (UAP)
C#
11
star
13

set-wallpaper-extension

Google Chrome extension that sets an image as desktop wallpaper.
C
10
star
14

hackathon-extension

HTML5 Chrome Extension for Google Ottawa Hackathon 2011
JavaScript
9
star
15

MyElectricCar

Hacking my BMW i3 and ChargePoint
C#
9
star
16

stream-filter-extension

Filter your stream by removing topics from words and monitor them
JavaScript
9
star
17

backbone.webStorage

Backbone.js webStorage sync provider
JavaScript
8
star
18

picture-in-picture-windows

So you could see your extended display on the primary display in a picture in picture frame
C#
7
star
19

bing-translate

Bing Translate iOS Action Extension, works in iOS, IE, Chrome, Safari, and Firefox
JavaScript
7
star
20

build-time-rendering-js

SSR anywhere, not just Node.JS
TypeScript
7
star
21

hangout-auto-try-again

Auto retry joining hangouts!
JavaScript
6
star
22

hackathon-letsgo.io

letsgo.io - Photo Hack Day 4 project
JavaScript
5
star
23

extended-embed-extension

Extended Embed for Google Plus Chome Extension
JavaScript
5
star
24

closure-depswriter

Closure Java Build tools
Java
4
star
25

library-lookup-extension

Hackathon Montreal 2011 - Why pay for a book while it is free in the library? This Chrome Extension will tell you the status of the book if it is available in the book store.
JavaScript
4
star
26

google-contacts-manager-java

Google Contacts Manager Viewer in Java
Java
3
star
27

hangout-whisper-for-plus

Using the Hangout API to Whisper to people in Hangouts
JavaScript
3
star
28

static-share-for-google-plus-extension

Let the sharebox on Google+ to be static. Chrome Extension
JavaScript
3
star
29

tv-rage-android

TV Rage Guide for Android
Java
3
star
30

accessible-hangouts-extension

Makes Hangouts more Accessible for the blind!
JavaScript
2
star
31

easy-dnd-swing

Generic Drag and Drop for any Swing component.
2
star
32

so.cl-notifications-extension

so.cl notification for Google Chrome
JavaScript
2
star
33

time-lapse-python

Doing a Time-Lapse desktop sharing in Python
Python
2
star
34

open-link-in-a-foreground-tab-extension

Google Chrome extension that allows a user to right click on any link and open it in the foreground
JavaScript
2
star
35

extended-photos-extension

Extended Photos for Google+ Extension
JavaScript
2
star
36

karen-hutton-extension

Voice overs when you +1/-1 a Google+ post, and like/unlike a Facebook post from Karen Hutton.
JavaScript
2
star
37

tf2parser

Team Fortress 2 PHP Parser
PHP
1
star
38

so.cl-extension-jsapi

Unofficial Microsoft so.cl JavaScript API for Browser Extensions
JavaScript
1
star
39

hackathon-airportoffuture-changi

Changi Airport of the Future Hackathon
JavaScript
1
star
40

ethereum-node-stats

Moved to ethereum/node-crawler
TypeScript
1
star
41

hackathon-hypenbc

NBC Bay Area Hackathon
JavaScript
1
star
42

personal-data-dashboard

Manage your personal social data on the web with ease
JavaScript
1
star
43

closure-simple-draw

Undo and redo actions for drawing in Closure. Demo on the URL below.
JavaScript
1
star
44

dotfiles

My Dotfiles for OSX
Shell
1
star
45

git-map

Executes git commands in multiple Git repositories at the same time.
Shell
1
star
46

trey-ratcliff-notifier

Trey Ratcliff Notifier Chrome Extension
1
star