pump-io / pump.io

Social server with an ActivityStreams API
http://pump.io/
Apache License 2.0
2.21k stars 334 forks source link

Provide a way to backup account #670

Open larjona opened 11 years ago

larjona commented 11 years ago

It would be nice to have a link to download a backup for the user's pump.io account, as it's possible in identi.ca (running StatusNet). I'm not sure if just providing in the "account" or "settings" page a download link/button to the feed and the inbox JSONs would be enough: /api/user//feed /api/user//inbox

larjona commented 10 years ago

Paul Wise from Debian shared his solution for downloading the ActivityStream of debian@identi.ca (around 1300 dents right now):

ffor offset in 0 200 400 600 800 1000 1200 1400 ; do wget --no-cookies --header 'Cookie: connect.sid=...' "https://identi.ca/api/user/debian/feed?count=200&offset=$offset" ; done

Some notes:

Hope it helps

larjona commented 10 years ago

A quick hack by kabniel@microca.st to get a convo tree you're part of in pypump (Thanks!):

"""
    Get conversation trees you are part of
    tested in pypump-shell 0.6
"""
def get_tree(limit=20):

    def get_branch(obj):
        root = {'obj': obj,
                'children': []
               }
        for i in obj.comments:
            root['children'].append(get_branch(i))
        return root

    mytree = {}
    for activity in pump.me.outbox[:limit]:
        try:
            if activity.verb == 'post':
                obj = activity.obj
                while obj.in_reply_to is not None:
                    # dig down to the convo root
                    obj = obj.in_reply_to
                if mytree.get(obj.id):
                    continue
                else:
                    # build the branches
                    mytree[obj.id] = get_branch(obj)
        except Exception as e:
            print(e)
    return mytree

def print_tree(mytree):

    def print_branch(branch, indent=0):
        print(u" "*indent + str(branch['obj'])) #only print obj strings for now
        for i in branch['children']:
            print_branch(i, indent+1)

    for k,v in mytree.items():
        print_branch(v)

mytree = get_tree(limit=20)

print_tree(mytree)
larjona commented 9 years ago

I've written a script (and howto) following Paul Wise's hints, to backup major and minor feed. It's available at https://gitorious.org/pumpscripts/pumpscripts