Social Graph API をPythonでやってみた

気になったのでやってみた。
自分のtwitterのページでFollowされているのを取得する。

まずはベースとなるURLが

http://socialgraph.apis.google.com/lookup

こちらは、
GoogleCodeに記載されている。
http://code.google.com/apis/socialgraph/

で引数を決める。
今回使用したのは、

・pretty(インデント・改行される。)
・callback(コールバック関数を指定)
・edo(FollowしているURLを表示させる)
In [1]: base_url = 'http://socialgraph.apis.google.com/lookup?q=http://twitter.com/kishir&pretty=1&callback=foo&
edo=1'

In [2]: html = opener.open(base_url).read()

In [3]: print html
foo({
 "canonical_mapping": {
  "http://twitter.com/kishir": "http://twitter.com/kishir"
 },
 "nodes": {
  "http://twitter.com/kishir": {
   "attributes": {
    "url": "http://twitter.com/kishir",
    "profile": "http://twitter.com/kishir",
    "rss": "http://twitter.com/statuses/user_timeline/kishir.rss",
    "atom": "http://twitter.com/statuses/user_timeline/kishir.atom"
   },
   "nodes_referenced": {
    "http://kishi-r.com/": {
     "types": [
      "me"
     ]
   },
    "http://twitter.com/kano_e": {
     "types": [
      "contact"
     ]
    },
    "http://twitter.com/soundkitchen": {
     "types": [
      "contact"
     ]
    },
    "http://twitter.com/tasukuchan": {
     "types": [
      "contact"
     ]
    },
    "http://twitter.com/yoshuki": {
     "types": [
      "contact"
     ]
    }
   }
  }
 }
});

なんでだろう?
Followされているユーザーが全て表示されない。
引数「q」に他のURLを加えると増えるのだが、
それも良くわからないなぁ~。

もうちょっと試してみるかな。
Posted at: 
2008/02/04 18:24:01
0 Comments
0 TrackBacks
Tags: 
Python
Trackback: 
http://kishi-r.com/2008/02/04/social_graph_api_python/trackback/

TrackBacks

まだ登録されていません。

Comments

まだ登録されていません。

Add Comment

Add Comment

kishirをフォローしましょう



あわせて読みたい 人気ブログランキング - kishi-r.com track feed

Categories