Main
Latest
- Google Maps and Geolocation
- oEmbed, flickr and starstar
- Petition Against Public Holidays
- Good Morning
- Django Apache Configuration
- Raising funds for Autism Western Cape
- When to release the code?
- Parsing Hashtags
- ISDSL International Weirdness
- Evolution a Theory?
Archives
- June 2004
- July 2004
- August 2004
- September 2004
- October 2004
- November 2004
- December 2004
- January 2005
- February 2005
- March 2005
- April 2005
- May 2005
- June 2005
- July 2005
- August 2005
- September 2005
- October 2005
- November 2005
- December 2005
- January 2006
- February 2006
- March 2006
- April 2006
- May 2006
- June 2006
- July 2006
- August 2006
- September 2006
- November 2006
- December 2006
- January 2007
- February 2007
- March 2007
- April 2007
- May 2007
- June 2007
- July 2007
- August 2007
- September 2007
- October 2007
- November 2007
- December 2007
- January 2008
- February 2008
- March 2008
- April 2008
- May 2008
- June 2008
- July 2008
- August 2008
- September 2008
- October 2008
- November 2008
- December 2008
- January 2009
Gnip API Changes
About three days ago, gnip decided to change their API, apparently without sending an e-mail to their (consumer) developers. The publisher.name attribute has been renamed to type and the twitter value has been changed to tweet. identica remains the same.
This broke the CLUG Micropark and I had to fix. Managed to come up with the following solution after some debugging. This has been checked into starstar with revision 5.
Index: update.php
===================================================================
--- update.php (revision 3)
+++ update.php (working copy)
@@ -33,7 +33,10 @@
$data = file_get_contents('php://input');
$xml = new SimpleXMLElement($data);
foreach ($xml->activity as $activity) {
- $service = $activity['publisher.name'];
+ $service = $activity['type'];
+ if ($service == 'tweet') {
+ $service = 'twitter';
+ }
$post_author_name = $activity['uid'];
$post_author_uri = getAuthorUri($post_author_name);
$post_date = date('Y-m-d H:i:s', strtotime($activity['at']));
But, why?
Copyright © 2004-2009 Charl van Niekerk. All articles are released under the Creative Commons Attribution 2.5 South Africa licence, unless where otherwise stated.


2 Comments
Comment by
Jud on Wednesday, September 10, 2008 5:07:00 PM
Our deepest apologies. This was inadvertent. I've posted about it here http://groups.google.com/group/gnip-community/browse_thread/thread/e72371be4cc88f3b
Two things:
1 - you've worked around the issue in a reasonable manner given the rest of your code (as visible in the diff).
2 - it's probably a little sketchy to derive "service" from the "type" field. "Type" is the type of activity, while publisher.name was the actual "service." Please checkout the post I reference above for Publisher/service derivation going forward.
Again... please accept our apologies here; our mistake.
- Gnip Team
Comment by
Charl van Niekerk on Wednesday, September 10, 2008 11:29:00 PM
Hi Jud,
Many thanks for your comment, much appreciated.
After reviewing your post, the change is making perfect sense to me and I support it. I commented directly on your post with my further thoughts.
Best Regards,
Charl
Post a Comment