Hello! There was a question about the solution proposed in this answer regarding receiving user comments left in a particular community on vk. It seems that I reproduced the procedure in my application, substituted the ID of the profile and the ID of a random user from the comment to the first post to this profile (changed their places), but every time an error message is displayed. Please take a look: https://i.stack.imgur.com/cixeP.png
In addition, the same method fails to use the following code ( from here ), which receives a list of community members:
VK.init({ apiId: 6456476 // ID Π²Π°ΡΠ΅Π³ΠΎ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ VK }); var membersGroups = []; // ΠΌΠ°ΡΡΠΈΠ² ΡΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ² Π³ΡΡΠΏΠΏΡ getMembers(30666517); // ΠΏΠΎΠ»ΡΡΠ°Π΅ΠΌ ΠΈΠ½ΡΠΎΡΠΌΠ°ΡΠΈΡ ΠΎ Π³ΡΡΠΏΠΏΠ΅ ΠΈ Π΅Ρ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ² function getMembers(group_id) { VK.Api.call('groups.getById', {group_id: group_id, fields: 'photo_50,members_count', v: '5.27'}, function(r) { if(r.response) { $('.group_info') .html('<img src="' + r.response[0].photo_50 + '"/><br/>' + r.response[0].name + '<br/>Π£ΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ²: ' + r.response[0].members_count); getMembers20k(group_id, r.response[0].members_count); // ΠΏΠΎΠ»ΡΡΠ°Π΅ΠΌ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ² Π³ΡΡΠΏΠΏΡ ΠΈ ΠΏΠΈΡΠ΅ΠΌ Π² ΠΌΠ°ΡΡΠΈΠ² membersGroups } }); } // ΠΏΠΎΠ»ΡΡΠ°Π΅ΠΌ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ² Π³ΡΡΠΏΠΏΡ, members_count - ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ² function getMembers20k(group_id, members_count) { var code = 'var members = API.groups.getMembers({"group_id": ' + group_id + ', "v": "5.27", "sort": "id_asc", "count": "1000", "offset": ' + membersGroups.length + '}).items;' // Π΄Π΅Π»Π°Π΅ΠΌ ΠΏΠ΅ΡΠ²ΡΠΉ Π·Π°ΠΏΡΠΎΡ ΠΈ ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΌΠ°ΡΡΠΈΠ² + 'var offset = 1000;' // ΡΡΠΎ ΡΠ΄Π²ΠΈΠ³ ΠΏΠΎ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠ°ΠΌ Π³ΡΡΠΏΠΏΡ + 'while (offset < 25000 && (offset + ' + membersGroups.length + ') < ' + members_count + ')' // ΠΏΠΎΠΊΠ° Π½Π΅ ΠΏΠΎΠ»ΡΡΠΈΠ»ΠΈ 20000 ΠΈ Π½Π΅ ΠΏΡΠΎΡΠ»ΠΈΡΡ ΠΏΠΎ Π²ΡΠ΅ΠΌ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠ°ΠΌ + '{' + 'members = members + "," + API.groups.getMembers({"group_id": ' + group_id + ', "v": "5.27", "sort": "id_asc", "count": "1000", "offset": (' + membersGroups.length + ' + offset)}).items;' // ΡΠ΄Π²ΠΈΠ³ ΡΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ² Π½Π° offset + ΠΌΠΎΡΠ½ΠΎΡΡΡ ΠΌΠ°ΡΡΠΈΠ²Π° + 'offset = offset + 1000;' // ΡΠ²Π΅Π»ΠΈΡΠΈΠ²Π°Π΅ΠΌ ΡΠ΄Π²ΠΈΠ³ Π½Π° 1000 + '};' + 'return members;'; // Π²Π΅ΡΠ½ΡΡΡ ΠΌΠ°ΡΡΠΈΠ² members VK.Api.call("execute", {code: code}, function(data) { if (data.response) { membersGroups = membersGroups.concat(JSON.parse("[" + data.response + "]")); // Π·Π°ΠΏΠΈΡΠ΅ΠΌ ΡΡΠΎ Π² ΠΌΠ°ΡΡΠΈΠ² $('.member_ids').html('ΠΠ°Π³ΡΡΠ·ΠΊΠ°: ' + membersGroups.length + '/' + members_count); if (members_count > membersGroups.length) // Π΅ΡΠ»ΠΈ Π΅ΡΠ΅ Π½Π΅ Π²ΡΠ΅Ρ
ΡΡΠ°ΡΡΠ½ΠΈΠΊΠΎΠ² ΠΏΠΎΠ»ΡΡΠΈΠ»ΠΈ setTimeout(function() { getMembers20k(group_id, members_count); }, 333); // Π·Π°Π΄Π΅ΡΠΆΠΊΠ° 0.333 Ρ. ΠΏΠΎΡΠ»Π΅ ΡΠ΅Π³ΠΎ Π·Π°ΠΏΡΡΡΠΈΠΌ Π΅ΡΠ΅ ΡΠ°Π· else // Π΅ΡΠ»ΠΈ ΠΊΠΎΠ½Π΅Ρ ΡΠΎ alert('Π£ΡΠ° ΡΠ΅ΡΡ Π·Π°ΠΊΠΎΠ½ΡΠ΅Π½! Π ΠΌΠ°ΡΡΠΈΠ²Π΅ membersGroups ΡΠ΅ΠΏΠ΅ΡΡ ' + membersGroups.length + ' ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ².'); } else { alert(data.error.error_msg); // Π² ΡΠ»ΡΡΠ°Π΅ ΠΎΡΠΈΠ±ΠΊΠΈ Π²ΡΠ²Π΅Π΄Π΅ΠΌ Π΅Ρ } }); }
offsetand inpost_count( i.stack.imgur.com/YbJVV.png ), so that all posts of the user specified inuser_idwithout gaps are covered. In the second example, the following error when trying to run: i.imgur.com/KglPnqh.png And when trying to save a procedure: i.imgur.com/xAc0pCf.png - iskander1220execute.getCommentsFromPosts?post_count=10&offset=0&user_id=1&owner_id=1- Mr Morganexecute. Otherwise, the questions are caused by non-standard behavior of the team (performed by the button from the βStored Proceduresβ) in two communities: in one community, ifpost_countspecify 25 in thepost_countfield (without filling in theuser_idandoffsetfields) - the Runtime error occurred during code window is displayed invocation: Too many operations ". In another community, where there are fewer comments and activities, the team works on 25, although the first one will earn only 5. What can this be connected with? - iskander1220