I need to get many (several thousand) posts from a certain wall, with the condition "placed before a certain date." I thought I would start a loop in which I would receive 100 posts through wall.get , using offset offset, inside I would make a date check and enter the result into an array.

But there was such a problem: during the time that my cycle is running (if it happens to be performed for a long time) several more records can be placed on the wall and then repeated records will appear in my array, and indeed everything will break. How can you deal with this?

Conducted research: I also thought of getting posts not through wall.get , but through wall.getById and getting posts from the end, one at a time, that is, starting from a certain date and going to the current moment. But this method looks much slower, and somehow you need to get a post-reference point (that is, the last post made before a certain date), and I do not know how you can get it.

  • In general, wall.get works pretty fast. As far as I remember, you can easily make 3 requests per second, i.e. receive 300 posts per second. But just in case, yes, you can simply remove duplicates. - Ilya Bizunov
  • @ Ilya, is there a limit on the frequency of requests for vk api? - LNK
  • Yes, there were some. Alas, I do not remember exactly the numbers. - Ilya Bizunov
  • @ Ilya, now I tried to start the loop for 100 iterations, with wall.get requests - everything works. - LNK

1 answer 1

Do wall.get in a loop - and then just remove the duplicates.