obj = plurklib.getPlurks(offset) part_owners = obj['plurk_users'] part_plurks = obj['plurks'] if len(part_plurks) == 0: break for plurk in part_plurks: if plurk['limited_to'] is not None: plurks.append(plurk) if len(plurks) == target_count: break owners.update(part_owners) offset = part_plurks[len(part_plurks)-1]['posted'] offset = plurklib.ctime2iso(offset) # dump for plurk in plurks: owner_id_str = str(plurk['owner_id']) owner = owners[owner_id_str] display_name = owner.get('display_name', owner['nick_name']) print ('%s [%s] %s' % ( display_name, plurk['qualifier'], plurk['content_raw']) ).encode('utf-8') limited_to = plurk['limited_to'] if limited_to == '|0|': print '\t(all_friends)' else:
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import plurklib target_user = 1165290 #jerryjcw target_count = 389 obj = plurklib.login(sys.argv[1]) user_info = obj['user_info'] print 'Login as %s (%s, id=%d, karma=%d)' % (user_info['nick_name'], user_info['display_name'], user_info['id'], user_info['karma']) offset = '' offset = plurklib.ctime2iso('Sat, 17 Oct 2009 09:41:19 GMT') owners = {} plurks = [] while len(plurks) < target_count: obj = plurklib.getUserPlurks(offset, target_user) part_owners = obj['plurk_users'] part_plurks = obj['plurks'] if len(part_plurks) == 0: break print 'Read', len(part_plurks), 'plurks' for plurk in part_plurks: if plurk['owner_id'] == target_user: plurks.append(plurk) if len(plurks) >= target_count: