Answer the question
In order to leave comments, you need to log in
Powershell+VK API. How to bypass the limit of 1000 objects?
Good day, comrades!
Help please with a problem.
I sketched a script for working with the VK API, but I can’t get around the limit on the number of objects.
Can you tell me if there are any errors in the script? I'm already stuck..
$i = 0
$uri = "https://api.vk.com/method/users.search?education_form='Очное отделение'&university_year=2019&graduation=2019&country=1&university_country=1&fields=domain&count=900&out=1&offset="+$i+"&access_token=03bdb304a427de9d761ae22c008d7a1995f2fcd2a5fae4dd5f4e2b3ae457fa2c1f8bf665cdfe6ec5ac107&v=5.68"
$request = Invoke-WebRequest -Uri $uri
$response_array = $request.content | ConvertFrom-Json
$request_count = $response_array.response.count
"Всего: " + $request_count
#$result = $null
$request_array = $null
for ($i = 0; $i -le $request_count ; $i=$i+900)
{
write-host $i
$uri = "https://api.vk.com/method/users.search?education_form='Очное отделение'&university_year=2019&graduation=2019&country=1&university_country=1&fields=domain&count=900&out=1&offset="+$i+"&access_token=03bdb304a427de9d761ae22c008d7a1995f2fcd2a5fae4dd5f4e2b3ae457fa2c1f8bf665cdfe6ec5ac107&v=5.68"
write-host $uri
$request = Invoke-WebRequest -Uri $uri
$response_array = ($request.content | ConvertFrom-Json).response.items
$request_array = $request_array + $response_array
write-host("Получаем $i")
Start-Sleep -m 340
}
Answer the question
In order to leave comments, you need to log in
Please note that even when using the offset parameter, only the first 1000 results are available to get information.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question