September 9th, 2012

Змей
  • skoblov

How to download all posts from journal

I try to make local copy of my friends posts for 2012 using flat API.

There are two ways to do this:

1. Get posts ID using mode=syncitems, and get posts later using mode=getevents. This method works only for my journal and communities. If I try to request data (mode=syncitems) from other journal, server answers "Client error: Don't have access to requested journal"

2. Downloads posts using mode=getevents & selecttype=syncitems & lastsync=.... This method works for any journals, but I can't find source of good value for lastsync time. If server returns first 100 posts, I need to continue using modification time of last received post. But LJ does not include it in answer (it present in mode=syncitems answer only)