forked from python273/vk_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvk_procedures
56 lines (46 loc) · 1.14 KB
/
vk_procedures
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
==========
CODE: get items x25
INPUT: MAX_COUNT, START_OFFSET, KEY, MY_PARAMS:json, METHOD, METHOD
----------
var max_count = %s,
start_offset = %s,
key = "%s",
offset = start_offset;
var params = {count: max_count, offset: offset} + %s;
var res = API.%s(params),
count = res.count,
items = res[key],
i = 1;
while(i < 25 && offset + max_count <= count) {
offset = i * max_count + start_offset;
params.offset = offset;
items = items + API.%s(params)[key];
i = i + 1;
}
return {count: count, items: items, offset: offset + max_count};
==========
CODE: VkRequestsPool for one method
INPUT: list_values:json, method
----------
var pool_values = %s,
i = 0,
responses = [];
while(i < pool_values.length) {
responses.push(API.%s(pool_values[i]))
i = i + 1;
}
return responses;
==========
CODE: VkRequestsPool for one param
INPUT: default_values:json, values:json,list, key, method
----------
var default_values = %s,
values = %s,
responses = [],
i = 0;
while(i < values.length) {
default_values.%s = values[i];
responses.push(API.%s(default_values));
i = i + 1;
}
return responses;