Created
October 30, 2017 20:11
-
-
Save lgg/2969f43c72f94dd1bb5cda22416c21f8 to your computer and use it in GitHub Desktop.
[VK] Move photos from saved to another album
This file contains hidden or 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
| <?php | |
| /* | |
| 1. git clone https://github.com/fdcore/vk.api | |
| 2. mv vk.api/src/vk.php ./vk.php | |
| 3. edit file index.php below | |
| */ | |
| include __DIR__ . '/vk.php'; | |
| $user_id = 1; //YOUR VK USER ID | |
| $user_token = ""; //YOUR VK USER TOKEN (see https://github.com/fdcore/vk.api to check how you will get it) | |
| $user_target_album_id = 12345; //TARGET VK ALBUM ID | |
| $app_secret = 'sadasd12sda'; //YOUR VK APP SECRET | |
| $app_id = 123; //YOUR VK APP ID | |
| $config['secret_key'] = $app_secret; | |
| $config['client_id'] = $app_id; // app client id | |
| $config['user_id'] = $user_id; // id current user (required | |
| $config['access_token'] = $user_token; | |
| $config['scope'] = 'photos'; // scope access | |
| $v = new Vk($config); | |
| $response = $v->photos->get(array( | |
| 'owner_id' => $user_id, | |
| 'album_id' => 'saved', | |
| 'count' => 1000, | |
| )); | |
| foreach($response["items"] as $res){ | |
| $response = $v->photos->move(array( | |
| 'owner_id' => $user_id, | |
| 'target_album_id' => $user_target_album_id, | |
| 'photo_id' => $res["id"], | |
| )); | |
| sleep(1); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment