sunlightlabs/lapidus — Issue #4: facebook graph results vary by url, loadfacebook command needs to compensate
Author: dcloud
Created: 2012-01-03 16:05:21+00:00
State: open
Labels: bug

The current loadfacebook management command works under the assumption that https://graph.facebook.com/ will return "shares" consistently for domains when the trailing slash is removed. This is true for the domains I tested initially, but upon adding http://capitolwords.org/, the trailing slash removal generates an error. For the http://capitolwords.org/ domain facebook returns "shares" on the url if the trailing slash exists, and returns facebook profile data if the the trailing slash does not exist.

So https://graph.facebook.com/?ids=http://politiwidgets.com/,http://influenceexplorer.com/,http://poligraft.com/,http://sunlightfoundation.com,http://capitolwords.org,http://sunlightfoundation.com/live/ returns

```
{
"http://politiwidgets.com/": {
"id": "http://politiwidgets.com/",
"shares": 27
},
"http://influenceexplorer.com/": {
"id": "http://influenceexplorer.com/",
"shares": 2681
},
"http://poligraft.com/": {
"id": "http://poligraft.com/",
"shares": 567
},
"http://sunlightfoundation.com": {
"id": "http://sunlightfoundation.com",
"shares": 2711
},
"http://sunlightfoundation.com/live/": {
"id": "http://sunlightfoundation.com/live/",
"shares": 2922
},
"http://capitolwords.org": {
"id": "180212938742112",
"name": "Capitol Words: Dig up some data on the words our legislators use every day.",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/276932_180212938742112_112843175_s.jpg",
"link": "http://capitolwords.org/",
"likes": 43,
"app_id": 242928982441473,
"category": "Website",
"website": "http://capitolwords.org",
"description": "Capitol Words explores the most popular words and phrases used by legislators in Washington. Search the data from 1996 to today by state, date or politician.",
"can_post": true
}
}
```

If we leave the trailing slashes on the urls, then capitolwords is fine and sunlightfoundation is not:

```
{
"http://politiwidgets.com/": {
"id": "http://politiwidgets.com/",
"shares": 27
},
"http://influenceexplorer.com/": {
"id": "http://influenceexplorer.com/",
"shares": 2681
},
"http://poligraft.com/": {
"id": "http://poligraft.com/",
"shares": 567
},
"http://capitolwords.org/": {
"id": "http://capitolwords.org/",
"shares": 571
},
"http://sunlightfoundation.com/live/": {
"id": "http://sunlightfoundation.com/live/",
"shares": 2922
},
"http://sunlightfoundation.com/": {
"id": "178197015563500",
"name": "Sunlight Foundation",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/373278_178197015563500_1787025024_s.jpg",
"link": "http://sunlightfoundation.com/",
"likes": 178,
"category": "Non-profit organization",
"website": "http://sunlightfoundation.com/",
"description": "Making government transparent and accountable.",
"can_post": true,
"talking_about_count": 1
}
}
```

Boo!