changeset 10:ccf1d9e741bd

corrected google apikey query, removed facebook query language
author Mathias Gebbe <mgebbe@intevation.de>
date Wed, 11 Jun 2014 23:43:28 +0200
parents 8363d4970c75
children 9d17cb5147ca
files README.md src/facebook.coffee src/google.coffee
diffstat 3 files changed, 34 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Wed Jun 11 22:34:20 2014 +0200
+++ b/README.md	Wed Jun 11 23:43:28 2014 +0200
@@ -15,8 +15,11 @@
 ###facebook (read / write)
 
 * get facebook newsfeed including some non-public posts
-  depending on your friends privacy configuration
   (text, links, pics, videos)
+  depending on your friends privacy configuration!
+  For example for those who have disabled all Platform apps 
+  from accessing their data
+  http://stackoverflow.com/questions/11135053/
 
 * post public pump posts and public shares to facebook
 
@@ -134,4 +137,4 @@
 hg clone https://hg.wald.intevation.org/pumpbridge/
 ```
 this software is based on https://github.com/e14n/pump2status and
-uses many tools from https://github.com/e14n/
+uses many tools made by https://github.com/e14n/
--- a/src/facebook.coffee	Wed Jun 11 22:34:20 2014 +0200
+++ b/src/facebook.coffee	Wed Jun 11 23:43:28 2014 +0200
@@ -193,42 +193,18 @@
   return
 
 ##############################################
-###### get facebook friends /remove all ######
+###### get facebook friends             ######
 ##############################################
 getFriends = (user) ->
   me = user.user_pumpio
-  id = user.user_ESN.substr(0,user.user_ESN.indexOf('@'))
   token = user.oauth_token
 
   EdgeControl.removeEdges(me,'@facebook')
   EdgeControl.removeEdges(me,'www.facebook.com')
 
   FB.setAccessToken token
-  FB.api "fql",
-    q: "SELECT uid2 FROM friend WHERE uid1 = me()"
-  , (res) ->
-    if not res or res.error
-      console.log (if not res then "error occurred" else res.error)
-      return
-
-    _.each res.data, (user) ->
-      getUserById(me,user.uid2,token) if user.id?
-      return
 
-    return
-
-  return
-
-##############################################
-###### get facebook likes               ######
-##############################################
-getPages = (user) ->
-  me = user.user_pumpio
-  token = user.oauth_token
-
-  FB.setAccessToken token
-
-  FB.api "me/likes",
+  FB.api "me/friends?limit=500",
     fields: [
       "id"
     ]
@@ -240,6 +216,29 @@
       getUserById(me,page.id,token) if user.id?
       return
 
+  return
+
+
+##############################################
+###### get facebook likes               ######
+##############################################
+getPages = (user) ->
+  me = user.user_pumpio
+  token = user.oauth_token
+
+  FB.setAccessToken token
+
+  FB.api "me/likes?limit=5000",
+    fields: [
+      "id"
+    ]
+  , (res) ->
+    if not res or res.error
+      console.log (if not res then "error occurred" else res.error)
+
+    _.each res.data, (page) ->
+      getUserById(me,page.id,token) if user.id?
+      return
 
   return
 
@@ -256,7 +255,7 @@
   
   FB.setAccessToken token
 
-  FB.api "me/home?limit=25&?since="+ts,
+  FB.api "me/home?limit=35&?since="+ts,
     fields: [
       "id"
       "type"
@@ -381,7 +380,7 @@
   options =
    host: 'graph.facebook.com'
    port: 443
-   path: '/' + id + '?access_token=' + token + '&' + fields
+   path: '/' + id + '?access_token=' + token + '&client_secret=' + secret + '&' + fields
 
   https.get(options, (res) ->
     #console.log "Got response: " + res.statusCode
--- a/src/google.coffee	Wed Jun 11 22:34:20 2014 +0200
+++ b/src/google.coffee	Wed Jun 11 23:43:28 2014 +0200
@@ -22,7 +22,6 @@
 
 bridgeid = config.bridgeid
 interval = config.interval
-API_KEY = config.gpAPI_KEY
 CLIENTID = config.gpCLIENTID
 CLIENTSECRET = config.gpCLIENTSECRET
 
@@ -135,7 +134,7 @@
   options =
    host: "www.googleapis.com"
    port: 443
-   path: "/plus/v1/people/me/people/visible?key=" + API_KEY + "&"
+   path: "/plus/v1/people/me/people/visible?key=" + CLIENTID + "&"
    headers:
      "Authorization": "Bearer " + token
 
@@ -182,7 +181,7 @@
   options =
    host: "www.googleapis.com"
    port: 443
-   path: "/plus/v1/people/" + targetid + "/activities/public?maxResults="+max_results+"&key=" + API_KEY
+   path: "/plus/v1/people/" + targetid + "/activities/public?maxResults="+max_results+"&key=" + CLIENTID
    headers:
      "Authorization": "Bearer " + token
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)