Hi all,
did any of you test AppengineJS' port of Google's
google.appengine.api.urlfetch ?
The simple code below queries
search.twitter.com for an Atom feed of
all tweets from @username or referring to @username . The server
responds ok (statusCode == 200) but the Atom feed is empty. If you
test the same URL with a conventional RSS reader you can see that
there's plenty of content.
var urlfetch = require("google/appengine/api/urlfetch");
exports.FromOrAbout = function(username) {
var result;
result = urlfetch.fetch("
http://search.twitter.com/search.atom?q=%40"
+ username + "+OR+from%3A" + username);
// return "
http://search.twitter.com/search.atom?q=%40" + username +
"+OR+from%3A" + username;
if (result.statusCode != 200)
return "" + result.status_code;
return JSON.stringify(result);
}
An example output of this function is below. The empty "content" is at
the very beginning.
{"content":{},"finalUrl":"null","statusCode":200,"headers":
{"Date":"Sun, 25 Jul 2010 08:22:54 GMT","Server":"hi","Status":"200
OK","X-Served-From":"sjc1r165","X-Runtime":"0.04593","Content-
Type":"application/atom+xml; charset=utf-8","X-Timeline-Cache-
Hit":"Hit","X-Served-By":"
sjc1r034.prod.twitter.com","Cache-
Control":"max-age=15, must-revalidate, max-age=1800","Expires":"Sun,
25 Jul 2010 08:52:54 GMT","Content-Length":"20397","Vary":"Accept-
Encoding","X-Varnish":"
2395602926","Age":"0","Via":"1.1 varnish","X-
Cache-Svr":"
sjc1r034.prod.twitter.com","X-
Cache":"MISS","Connection":"close"}}
Thanks for any hint!
G.