{"id":293602,"date":"2019-08-20T09:00:42","date_gmt":"2019-08-20T09:00:42","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=293602"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=293602","title":{"rendered":"\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e VK API. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u0430\u043f\u0447\u0435\u0439 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043a\u043e\u0434 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/46\/r2\/ba\/46r2baf00uhoixq-saia7wegqfu.jpeg\" alt=\"image\"><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h2>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 vk_api \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 VK API \u0434\u043b\u044f Python: pip install vk_api  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b vk_api<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import vk_api  #\u041b\u043e\u0433\u0438\u043d (\u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430) \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0412\u041a  vk_session = vk_api.VkApi('login', 'password') vk_session.auth()  vk = vk_session.get_api()  #\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442 \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c 'Hello world!' vk.wall.post(message='Hello world!')  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438  <\/p>\n<pre><code class=\"python\">import os import time import random import requests  import vk_api  from vk_api.utils import get_random_id from urllib import urlretrieve <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0412\u041a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e API  <\/p>\n<pre><code class=\"python\">vk_session = vk_api.VkApi('+7999132****', '*********') vk_session.auth()  vk = vk_session.get_api() <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 <\/h2>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435.<br \/>  photos.getOwnerPhotoUploadServer() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.  <\/p>\n<pre><code class=\"python\">url = vk.photos.getOwnerPhotoUploadServer()['upload_url'] <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 upload_url, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u0435, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0432 POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043b\u0435\u043c photo.  <\/p>\n<pre><code class=\"python\">#\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 images images = os.listdir(\"images\")  photo = [] for image in images:     request = requests.post(url, files={'photo': open('images\/'+image, 'rb')}).json()     photo.append(request['photo']) <\/code><\/pre>\n<p>  \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u0445\u0435\u0448\u0430. \u041e\u043d\u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f.  <\/p>\n<pre><code class=\"python\">server = request['server']  hash = request['hash'] <\/code><\/pre>\n<h2>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f<\/h2>\n<p>  photos.saveOwnerPhoto() \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.  <\/p>\n<pre><code class=\"python\">#\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u0443\u044e \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u043f\u0440\u043e\u0444\u0438\u043b\u044f  x = random.randint(0, len(photo)-1) vk.photos.saveOwnerPhoto(server = server, hash = hash, photo = photo[x]) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043d\u0430 \u0441\u0442\u0435\u043d\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442 \u0441 \u044d\u0442\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0435\u0439. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u043e\u0441\u0442\u044b, \u0442\u043e \u043b\u0435\u043d\u0442\u0430 \u0434\u0440\u0443\u0437\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u0438\u0442\u0430 \u043f\u043e\u0441\u0442\u0430\u043c\u0438 \u043f\u0440\u043e \u0432\u0430\u0448\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0432\u0430\u0442\u0430\u0440\u043a\u0438.  <\/p>\n<pre><code class=\"python\">posts = vk.wall.get() post_id = posts[\"items\"][0][\"id\"] vk.wall.delete(post_id = post_id) <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u0434, \u0442\u043e \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f.<br \/>  \u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u0438\u043d\u0443\u0442\u0443 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438.  <\/p>\n<pre><code class=\"python\">y = 0 while(True):     x = random.randint(0, len(photo)-1)     while(x == y):         x = random.randint(0, len(photo)-1)     y = x     #x \u0438 y \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0434\u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u043b\u0430\u0441\u044c 2 \u0440\u0430\u0437\u0430 \u043f\u043e\u0434\u0440\u044f\u0434          vk.photos.saveOwnerPhoto(server = server, hash = hash, photo = photo[x])      posts = vk.wall.get()     post_id = posts[\"items\"][0][\"id\"]     vk.wall.delete(post_id = post_id)           #\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e      photos = vk.photos.getAll()     if (photos['count']&gt;1):         photo_id = photos[\"items\"][1][\"id\"]         vk.photos.delete(photo_id = photo_id)          time.sleep(60) #\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 60 \u0441\u0435\u043a. <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import os import time import random import requests  import vk_api  from vk_api.utils import get_random_id from urllib import urlretrieve  vk_session = vk_api.VkApi('+7999132****', '***********') vk_session.auth()  vk = vk_session.get_api()  images = os.listdir(\"images\")  url = vk.photos.getOwnerPhotoUploadServer()['upload_url']  photo = [] for image in images:     request = requests.post(url, files={'photo': open('images\/'+image, 'rb')}).json()     photo.append(request['photo'])  server = request['server']  hash = request['hash']  y = 0 while(True):     x = random.randint(0, len(photo)-1)     while(x == y):         x = random.randint(0, len(photo)-1)     y = x                     vk.photos.saveOwnerPhoto(server = server, hash = hash, photo = photo[x])      posts = vk.wall.get()     post_id = posts[\"items\"][0][\"id\"]     vk.wall.delete(post_id = post_id)            photos = vk.photos.getAll()     if (photos['count']&gt;1):         photo_id = photos[\"items\"][1][\"id\"]         vk.photos.delete(photo_id = photo_id)              time.sleep(60) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0432\u044b\u0439\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430  <\/p>\n<blockquote><p>Captcha: Captcha needed<\/p><\/blockquote>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u0430\u043f\u0447\u0435\u0439 \u0432 VK API.  <\/p>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 captcha<\/h2>\n<p>   \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 vk_api.VkApi() \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u0430\u043f\u0447\u0435\u0439. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0440\u043e\u043c\u0435 \u043b\u043e\u0433\u0438\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u043f\u0447\u0438 captcha_handler.<br \/>  \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c vk_session  <\/p>\n<pre><code class=\"python\">vk_session = vk_api.VkApi('+7999132****', '**********', captcha_handler=captcha_handler) <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e captcha_handler(captcha), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441\u0441 \u043a\u0430\u043f\u0447\u0438, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043f\u0447\u0438 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0436\u0434\u0451\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043a\u0430\u043f\u0447\u0435\u0439 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.   <\/p>\n<pre><code class=\"python\">def captcha_handler(captcha):          #\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u0441 \u043a\u0430\u043f\u0447\u0438     captcha_url = captcha.get_url()           #\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043f\u0447\u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440     urlretrieve(captcha_url, \"captcha.jpg\")          #\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043b\u044e\u0447 (send_captcha() \u0441\u043c. \u0434\u0430\u043b\u0435\u0435)     key = send_captcha(captcha_url)          #\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u044e\u0447 (\u0442\u0435\u043a\u0441\u0442) \u043a\u0430\u043f\u0447\u0438     return captcha.try_again(key) <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u043f\u0447\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<br \/>  \u041c\u0435\u0442\u043e\u0434\u044b messages \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c token.<\/p>\n<ol>\n<li> \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0433\u0440\u0443\u043f\u043f\u0443\/\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <\/li>\n<li> \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 =&gt; \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 API =&gt; \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u044e\u0447<\/li>\n<li> \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c:\n<ul>\n<li> \u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 <\/li>\n<li> \u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 <\/li>\n<\/ul>\n<\/li>\n<li> \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u044e\u0447\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043d\u0430\u0434\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0433\u0440\u0443\u043f\u043f\u044b (\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 =&gt; \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f) \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (\u0432 \u043c\u0435\u043d\u044e \u0433\u0440\u0443\u043f\u043f\u044b)<\/p>\n<pre><code class=\"python\">def send_captcha(captcha_url):     #token (\u043a\u043b\u044e\u0447) \u0433\u0440\u0443\u043f\u043f\u044b     token = \"\u041a\u041b\u042e\u0427\"          vk_session = vk_api.VkApi(token = token)     vk = vk_session.get_api()          #\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u043a\u0430\u043f\u0447\u0438     url = vk.photos.getMessagesUploadServer()['upload_url']          #\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435      request = requests.post(url, files={'photo': open(\"captcha.jpg\", 'rb')}).json()          #\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e     photo = vk.photos.saveMessagesPhoto(server=request['server'],                                         photo = request['photo'],                                         hash = request['hash'])          attachment = 'photo{}_{}'.format(photo[0]['owner_id'], photo[0]['id'])          #\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     vk.messages.send(         user_id = \u0412\u0410\u0428_ID,         attachment = attachment,         random_id=get_random_id())          #\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043a\u0430\u043f\u0447\u0443     os.remove(\"captcha.jpg\")          #\u0416\u0434\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430     key = ''     while (key == ''):         #\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0434\u0438\u0430\u043b\u043e\u0433         messages = vk.messages.getDialogs()['items'][0]                  #\u0415\u0441\u043b\u0438 \u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e \u043d\u0435 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u043e \u043a\u043b\u044e\u0447          if 'attachments' not in messages['message'].keys():             key = messages['message']['body']     return key <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u0434, \u0442\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u0435\u0440\u0432\u0451\u043c \u0435\u0451 \u0440\u0430\u0431\u043e\u0442\u0443. \u041a\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u043f\u0447\u0443, \u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043f\u0447\u0438 \u043f\u0440\u0438\u0434\u0451\u0442 \u0432 \u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0441\u044f.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import os import time import random import requests  import vk_api  from vk_api.utils import get_random_id from urllib import urlretrieve  def captcha_handler(captcha):          captcha_url = captcha.get_url()          urlretrieve(captcha_url, \"captcha.jpg\")          key = send_captcha(captcha_url)          print(key)     return captcha.try_again(key)  def send_captcha(captcha_url):     token = \"\u041a\u041b\u042e\u0427\"          vk_session = vk_api.VkApi(token = token)     vk = vk_session.get_api()          url = vk.photos.getMessagesUploadServer()['upload_url']          request = requests.post(url, files={'photo': open(\"captcha.jpg\", 'rb')}).json()          photo = vk.photos.saveMessagesPhoto(server=request['server'],                                         photo = request['photo'],                                         hash = request['hash'])          attachment = 'photo{}_{}'.format(photo[0]['owner_id'], photo[0]['id'])          vk.messages.send(         user_id=\u0412\u0410\u0428_ID,         attachment = attachment,         random_id=get_random_id())          os.remove(\"captcha.jpg\")          key = ''     while (key == ''):         messages = vk.messages.getDialogs()['items'][0]         if 'attachments' not in messages['message'].keys():             key = messages['message']['body']     return key  vk_session = vk_api.VkApi('+7999132****', '*********', captcha_handler=captcha_handler) vk_session.auth()  vk = vk_session.get_api()  images = os.listdir(\"images\")  url = vk.photos.getOwnerPhotoUploadServer()['upload_url']  photo = [] for image in images:     request = requests.post(url, files={'photo': open('images\/'+image, 'rb')}).json()     photo.append(request['photo'])  server = request['server']  hash = request['hash']  y = 0 while(True):     x = random.randint(0, len(photo)-1)     while(x == y):         x = random.randint(0, len(photo)-1)     y = x                     vk.photos.saveOwnerPhoto(server = server, hash = hash, photo = photo[x])      posts = vk.wall.get()     post_id = posts[\"items\"][0][\"id\"]     vk.wall.delete(post_id = post_id)            photos = vk.photos.getAll()     if (photos['count']&gt;1):         photo_id = photos[\"items\"][1][\"id\"]         vk.photos.delete(photo_id = photo_id)              print(\"Successfully\", x)     time.sleep(60) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043b\u044f \u043a\u0440\u0443\u0433\u043b\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e VPS \u0445\u043e\u0441\u0442\u0438\u043d\u0433. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e \u043a\u043e\u0434 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. <br \/>  <a href=\"https:\/\/github.com\/ilikeevb\/vk_saveOwnerPhoto\">\u041a\u043e\u0434 \u043d\u0430 github<\/a><br \/>  \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0438\u043b\u0438 \u0432 \u041b\u0421.<\/li>\n<\/ol>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/464285\/\"> https:\/\/habr.com\/ru\/post\/464285\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e VK API. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u0430\u043f\u0447\u0435\u0439 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043a\u043e\u0434 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/46\/r2\/ba\/46r2baf00uhoixq-saia7wegqfu.jpeg\" alt=\"image\">  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-293602","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=293602"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/293602\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=293602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=293602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=293602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}