I
I
Islamfon2015-10-23 15:15:35
In contact with
Islamfon, 2015-10-23 15:15:35

Why does the VK API method video.search often return empty data?

$xml= simplexml_load_file('https://api.vk.com/method/video.search.xml?q=test&offset=0&count=10&access_token=token&v=5.37');

For example, I want to get 10 videos, but sometimes for some queries it only displays 7,8,9 results.
I realized that this is due to the fact that sometimes empty data items: [] are called.
Because of this, the data count is lost.
How can I make it so that empty data is not called at all and always returns 10 results?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sivabur, 2015-10-23
@sivabur

The first thing that comes to mind is to control yourself.
Well, if you go further, just test with different parameters and log the answer. Then, based on comparing them with the results of a manual video search, identify patterns.
In addition to the options, there are videos that have been removed for copyright infringement, there are videos from YouTube embedded, from other players, old videos [that have been uploaded long ago] on VK (on a flash), and new ones on html5.
If all this still does not help, competent multi-counting so as not to exceed the number of requests + proxy as needed.
There are functions that are not designed for this well, they can also help. You can also try different versions.

V
Vladislav Startsev, 2015-10-23
@esvlad

It's just that these given data are not there, because this is a search, and the search cannot find something that, in principle, does not exist. This is about what is indicated in ? q='Search query '

response: {
count: 0,
items: []
}

and the query "Programmer"
response: {
count: 21056, //количество найденых видео
items: [{ //и начнет выводить согласно доп. параметрам
id: 171107068,
owner_id: 248902071,
.....
}]
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question