繼上一篇 Plurk API 使用者資訊查詢(3),可以查到需要使用的UID後,

可繼續撰寫想列出的使用者 Plurk 內容

在這裡使用 /API/Profile/getPublicProfile Plurk API 傳入 UID 與 API Key

 

import urllib, urllib2, cookielib, json

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
api_key = '你的 API Key'
get_api_url = lambda x: 'http://www.plurk.com/API%s' % x
encode = urllib.urlencode
    
fp=opener.open(get_api_url('/Profile/getPublicProfile'),
                 encode({'user_id': '你要顯示Plurk的使用者 uid',                        
                         'api_key': api_key}))    
                        
data=json.loads(fp.read())
for i in data['plurks']:
    print i['content'],'\n'       


 

儲存成 test3.py,在命令提示字元中輸入 python test3.py 執行

執行結果

2010-03-19_132718.jpg

arrow
arrow
    全站熱搜

    iammic 發表在 痞客邦 留言(0) 人氣()