Created
October 28, 2015 17:36
-
-
Save ip/e6656211ad63cef14561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This snippet for VK.com adds audio tracks from user page to the group. | |
// Insert your parameters and execute it multiple times (it copies "count" tracks at time) | |
// Insert your values here | |
var user_id=123; | |
var group_id=456; | |
// Max requests number per execution is 25 | |
var count = 25-3; | |
var tracks_total = API.audio.getCount({"owner_id": user_id}); | |
var tracks_added = API.audio.getCount({"owner_id": -group_id}); | |
var offset = tracks_total - tracks_added - count; | |
var track_list = API.audio.get({"owner_id": user_id, | |
"offset": offset, "count": count}).items@.id; | |
var i = count - 1; | |
while (i >= 0) { | |
API.audio.add({ | |
"audio_id": track_list[i], | |
"owner_id": user_id, | |
"group_id": group_id | |
}); | |
i = i - 1; | |
} | |
return 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment