{"id":471533,"date":"2025-08-21T15:03:01","date_gmt":"2025-08-21T15:03:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=471533"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=471533","title":{"rendered":"<span>\u041f\u0430\u0440\u0441\u0438\u043c \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0441\u0442\u0430\u043c\u0438 VK: \u0420\u0430\u0437\u0431\u043e\u0440 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/shilvlad\/vk_post_managment\" rel=\"noopener noreferrer nofollow\">Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/a> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0435\u043d\u043e\u0439 VK. \u041d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 API. \u041d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0442\u0435\u043d\u043a\u0443 \u0432 \u0412\u041a. \u0416\u0438\u0437\u043d\u044c, \u0437\u043d\u0430\u0435\u0442\u0435 \u043b\u0438, \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u0430\u044f \u043d\u044b\u043d\u0447\u0435 \ud83d\ude42 \u041d\u043e, \u0432 \u0446\u0435\u043b\u043e\u043c, \u043c\u043d\u0435 \u0432\u0438\u0434\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0442\u0430\u043a \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u043e\u0434\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043e\u0446\u0441\u0435\u0442\u0438.<\/p>\n<h3>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h3>\n<ul>\n<li>\n<p>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 VK API<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u043b\u043e\u043c\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 VK API<\/h3>\n<p>VK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0449\u043d\u044b\u0439 API \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u043d\u0443\u0436\u0435\u043d\u00a0<strong>access token<\/strong>\u00a0\u2014 \u043a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u0430\u0432\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b API:<\/p>\n<ul>\n<li>\n<p><code>users.get<\/code>\u00a0\u2014 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435<\/p>\n<\/li>\n<li>\n<p><code>wall.get<\/code>\u00a0\u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441\u043e \u0441\u0442\u0435\u043d\u044b<\/p>\n<\/li>\n<li>\n<p><code>wall.delete<\/code>\u00a0\u2014 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/h3>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u043e \u041e\u041e\u041f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u00a0<code>VKParser<\/code>\u00a0\u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API:<\/p>\n<pre><code class=\"python\">class VKParser:     def init(self, login, password):     self.login = login     self.password = password     self.session = requests.Session()     self.access_token = None     self.user_id = None<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u00a0<code>requests.Session()<\/code>\u00a0\u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f cookies \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<h3>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438<\/h3>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 access token<\/h4>\n<p>\u041f\u0440\u044f\u043c\u043e\u0439 \u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c \u0432 VK API \u0434\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043f\u043e\u0441\u0435\u043c\u0443, \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c token \u0447\u0435\u0440\u0435\u0437 OAuth:<\/p>\n<pre><code class=\"python\">def login_vk(self):     auth_url = \"https:\/\/oauth.vk.com\/authorize\"     auth_params = {         'client_id': '6121396',  # Standalone app ID         'redirect_uri': 'https:\/\/oauth.vk.com\/blank.html',         'display': 'page',         'scope': 'wall,offline',  # Requested permissions         'response_type': 'token',         'v': '5.131'  # API version     }          # Generate auth URL     auth_link = f\"{auth_url}?{'&amp;'.join([f'{k}={v}' for k, v in auth_params.items()])}\"     print(f\"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: {auth_link}\")<\/code><\/pre>\n<h4>\u041f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (scope)<\/h4>\n<ul>\n<li>\n<p><code>wall<\/code>\u00a0\u2014 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0442\u0435\u043d\u0435 (\u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p><code>offline<\/code>\u00a0\u2014 \u0431\u0435\u0441\u0441\u0440\u043e\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0431\u0435\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><code>groups<\/code>\u00a0\u2014 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0433\u0440\u0443\u043f\u043f\u0430\u043c (\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e)<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439<\/h3>\n<p>VK API \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u044b \u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438 (\u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e 100 \u0437\u0430 \u0437\u0430\u043f\u0440\u043e\u0441), \u0441 \u0447\u0435\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u0442\u0438\u043c\u0438\u0448\u0432\u0438\u043b\u0438. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043e\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">def get_all_posts(self):     all_posts = []     offset = 0     count = 100  # Max per request          while True:         response = self._make_api_request('wall.get', {             'owner_id': self.user_id,             'count': count,             'offset': offset         })                  posts = response['response']['items']         if not posts:             break                      all_posts.extend(posts)         offset += count                  time.sleep(0.5)  # Rate limiting                  if len(posts) &lt; count:             break          return all_posts<\/code><\/pre>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 rate limits<\/h4>\n<p>\u0412\u0430\u0436\u043d\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043b\u0438\u043c\u0438\u0442\u044b VK API (1000 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u0442\u0435\u043d\u044b \u0443\u0434\u0430\u043b\u044f\u043b\u0438\u0441\u044c \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e):<\/p>\n<ul>\n<li>\n<p>3 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u00a0<code>time.sleep(0.5)<\/code>\u00a0\u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h3>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/h3>\n<h4>\u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u2014 \u043d\u0435\u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0443\u0442 \u0442\u0440\u043e\u0439\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u043a\u043e\u0434\u043e\u043c. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430:<\/p>\n<pre><code class=\"python\">def delete_posts_with_confirmation(self):     print(\"\u26a0\ufe0f  \u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415! \u042d\u0422\u0410 \u041e\u041f\u0415\u0420\u0410\u0426\u0418\u042f \u041d\u0415\u041e\u0411\u0420\u0410\u0422\u0418\u041c\u0410! \u26a0\ufe0f\")          confirmation1 = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 'DELETE MY POSTS' \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f: \")     if confirmation1 != \"DELETE MY POSTS\":         return False          confirmation2 = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 'YES I AM SURE' \u0434\u043b\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f: \")     if confirmation2 != \"YES I AM SURE\":         return False          return self._delete_posts(posts)<\/code><\/pre>\n<h4>\u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043e\u0442\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u044c\u044e<\/h4>\n<pre><code class=\"python\">def _delete_posts(self, posts):     deleted_count = 0     error_count = 0          for i, post in enumerate(posts, 1):         response = self._make_api_request('wall.delete', {             'owner_id': self.user_id,             'post_id': post['id']         })                  if response and response['response'] == 1:             deleted_count += 1         else:             error_count += 1                  time.sleep(1)  # Important delay          print(f\"\u0423\u0441\u043f\u0435\u0448\u043d\u043e: {deleted_count}, \u041e\u0448\u0438\u0431\u043e\u043a: {error_count}\")     return error_count == 0<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b<\/h4>\n<pre><code class=\"python\">parser = VKParser(\"your_login\", \"your_password\")  # \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f if parser.login_vk():     # \u041f\u041e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u044b     posts = parser.get_all_posts()     print(f\"\u041d\u0430\u0439\u0434\u0435\u043d\u043e {len(posts)} \u043f\u043e\u0441\u0442\u043e\u0432\")          # \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u0430     parser.save_posts_to_file(posts)          # \u0423\u0434\u0430\u043b\u044f\u0435\u043c (\u0441 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c)     parser.delete_posts_with_confirmation()<\/code><\/pre>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043e\u043b\u043e\u043c\u043a\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0444\u0430\u043a\u0430\u043f\u0430<\/h3>\n<h4>1. \u0411\u044d\u043a\u0430\u043f \u043f\u0435\u0440\u0435\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c<\/h4>\n<p>\u0412\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0439\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u043b\u044e\u0431\u044b\u043c\u0438 destructive-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"python\">def save_posts_to_file(self, texts, filename='vk_posts.txt'):     with open(filename, 'w', encoding='utf-8') as f:         f.write(f\"\u0412\u0441\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u0432: {len(texts)}\\n\")         for text in texts:             f.write(text + \"\\n\\n\")<\/code><\/pre>\n<h4>2. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a API<\/h4>\n<pre><code class=\"python\">def _make_api_request(self, method, params):     try:         response = self.session.get(             f'https:\/\/api.vk.com\/method\/{method}',             params=params,             timeout=30         )         data = response.json()                  if 'error' in data:             print(f\"API Error: {data['error']['error_msg']}\")             return None                      return data     except Exception as e:         print(f\"Request failed: {e}\")         return None<\/code><\/pre>\n<h4>3. \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/h4>\n<p>\u0412 \u043a\u043e\u0434\u0435, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432\/\u0442\u043e\u043a\u0435\u043d\u043e\u0432\/\u043f\u0430\u0440\u043e\u043b\u0435\u0439! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">import os  token = os.getenv('VK_ACCESS_TOKEN') if not token:     token = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 access token: \")<\/code><\/pre>\n<h3>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f, \u043d\u043e, \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u0441 \u0447\u0435\u043c \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438. \u0422\u0443\u0442 \u043d\u0430\u043c \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 JSON, XML \u0438 \u0442\u0434, \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u043e\u0447\u0435\u0435.<\/p>\n<p><em>\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u043d\u0435\u0441\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/em><\/p>\n<p><em>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <\/em><a href=\"https:\/\/github.com\/shilvlad\/vk_post_managment\" rel=\"noopener noreferrer nofollow\"><em>GitHub<\/em><\/a><em> \u0438 \u043d\u0438\u0436\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/em><\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import requests import json import time   class VKParser:     def __init__(self, login, password):         self.login = login         self.password = password         self.session = requests.Session()         self.access_token = None         self.user_id = None      def login_vk(self):         \"\"\"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 VK\"\"\"         print(\"\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e...\")          # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438         auth_url = \"https:\/\/oauth.vk.com\/authorize\"         auth_params = {             'client_id': '6121396',             'redirect_uri': 'https:\/\/oauth.vk.com\/blank.html',             'display': 'page',             'scope': 'wall,offline,groups',  # \u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u0430 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f             'response_type': 'token',             'v': '5.131'         }          print(\"\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c access_token\")         print(\"\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0435\u0433\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435:\")         print(f\"{auth_url}?{'&amp;'.join([f'{k}={v}' for k, v in auth_params.items()])}\")         print(\"\\n\u041f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 access_token \u0438\u0437 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\")          self.access_token = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 access_token: \").strip()          if self.access_token:             user_info = self._make_api_request('users.get', {})             if user_info and 'response' in user_info:                 self.user_id = user_info['response'][0]['id']                 print(f\"\u0423\u0441\u043f\u0435\u0448\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f! User ID: {self.user_id}\")                 return True             else:                 print(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0442\u043e\u043a\u0435\u043d.\")                 return False         return False      def _make_api_request(self, method, params):         \"\"\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a VK API\"\"\"         params['access_token'] = self.access_token         params['v'] = '5.131'          try:             response = self.session.get(                 f'https:\/\/api.vk.com\/method\/{method}',                 params=params,                 timeout=30             )             return response.json()         except Exception as e:             print(f\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a API: {e}\")             return None      def get_all_posts(self):         \"\"\"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441\u043e \u0441\u0442\u0435\u043d\u044b\"\"\"         if not self.access_token:             print(\"\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e!\")             return []          print(\"\u041d\u0430\u0447\u0438\u043d\u0430\u044e \u0441\u0431\u043e\u0440 \u043f\u043e\u0441\u0442\u043e\u0432...\")         all_posts = []         offset = 0         count = 100          while True:             print(f\"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e \u043f\u043e\u0441\u0442\u044b, offset: {offset}\")              response = self._make_api_request('wall.get', {                 'owner_id': self.user_id,                 'count': count,                 'offset': offset             })              if not response or 'response' not in response:                 print(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u0432\")                 break              posts = response['response']['items']             if not posts:                 break              all_posts.extend(posts)             offset += count              time.sleep(0.5)              if len(posts) &lt; count:                 break          return all_posts      def delete_all_posts(self):         \"\"\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441\u043e \u0441\u0442\u0435\u043d\u044b\"\"\"         if not self.access_token:             print(\"\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e!\")             return False          print(\"\u26a0\ufe0f  \u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415! \u042d\u0422\u0410 \u041e\u041f\u0415\u0420\u0410\u0426\u0418\u042f \u041d\u0415\u041e\u0411\u0420\u0410\u0422\u0418\u041c\u0410! \u26a0\ufe0f\")         print(\"\u0412\u0441\u0435 \u043f\u043e\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0431\u0435\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f!\")          confirmation = input(\"\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b? (\u0432\u0432\u0435\u0434\u0438\u0442\u0435 'DELETE ALL' \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f): \")         if confirmation != \"DELETE ALL\":             print(\"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430.\")             return False          posts = self.get_all_posts()         if not posts:             print(\"\u041f\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0442.\")             return True          print(f\"\u041d\u0430\u0439\u0434\u0435\u043d\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f: {len(posts)}\")          deleted_count = 0         error_count = 0          for i, post in enumerate(posts, 1):             print(f\"\u0423\u0434\u0430\u043b\u044f\u044e \u043f\u043e\u0441\u0442 {i}\/{len(posts)}...\")              # \u0427\u0442\u043e \u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0441\u0442 \u043d\u0443\u0436\u0435\u043d \u0435\u0433\u043e ID \u0438 owner_id             response = self._make_api_request('wall.delete', {                 'owner_id': self.user_id,                 'post_id': post['id']             })              if response and 'response' in response and response['response'] == 1:                 deleted_count += 1                 print(f\"\u2713 \u041f\u043e\u0441\u0442 {post['id']} \u0443\u0434\u0430\u043b\u0435\u043d\")             else:                 error_count += 1                 print(f\"\u2717 \u041e\u0448\u0438\u0431\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0430 {post['id']}\")                 if 'error' in response:                     print(f\"   \u041a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438: {response['error']['error_code']}\")                     print(f\"   \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: {response['error']['error_msg']}\")              # \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0447\u0442\u043e \u0431 \u0412\u041a \u043d\u0435 \u0431\u043b\u043e\u0447\u0438\u043b             time.sleep(1)          print(f\"\\n\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f:\")         print(f\"\u0423\u0441\u043f\u0435\u0448\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u043e: {deleted_count}\")         print(f\"\u041e\u0448\u0438\u0431\u043e\u043a: {error_count}\")          return error_count == 0      def delete_posts_with_confirmation(self):         \"\"\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c\"\"\"         if not self.access_token:             print(\"\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e!\")             return False          posts = self.get_all_posts()         if not posts:             print(\"\u041f\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0442.\")             return True          print(f\"\\n\u041d\u0430\u0439\u0434\u0435\u043d\u043e \u043f\u043e\u0441\u0442\u043e\u0432: {len(posts)}\")         print(\"\u041f\u0435\u0440\u0432\u044b\u0435 5 \u043f\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430:\")          # \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u043e\u0441\u0442\u043e\u0432         for i, post in enumerate(posts[:5], 1):             post_date = time.strftime('%Y-%m-%d', time.localtime(post['date']))             text_preview = post['text'][:100] + \"...\" if len(post['text']) &gt; 100 else post['text']             print(f\"{i}. [{post_date}] {text_preview}\")          print(f\"\\n\u26a0\ufe0f  \u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415! \u0411\u0423\u0414\u0423\u0422 \u0423\u0414\u0410\u041b\u0415\u041d\u042b \u0412\u0421\u0415 {len(posts)} \u041f\u041e\u0421\u0422\u041e\u0412! \u26a0\ufe0f\")         print(\"\u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c!\")          # \u0414\u0432\u043e\u0439\u043d\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435         confirmation1 = input(\"\\n\u0412\u0432\u0435\u0434\u0438\u0442\u0435 'DELETE MY POSTS' \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f: \")         if confirmation1 != \"DELETE MY POSTS\":             print(\"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430.\")             return False          confirmation2 = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 'YES I AM SURE' \u0434\u043b\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f: \")         if confirmation2 != \"YES I AM SURE\":             print(\"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430.\")             return False          return self._delete_posts(posts)      def _delete_posts(self, posts):         \"\"\"\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432\"\"\"         deleted_count = 0         error_count = 0          for i, post in enumerate(posts, 1):             print(f\"\u0423\u0434\u0430\u043b\u044f\u044e \u043f\u043e\u0441\u0442 {i}\/{len(posts)} (ID: {post['id']})...\")              response = self._make_api_request('wall.delete', {                 'owner_id': self.user_id,                 'post_id': post['id']             })              if response and 'response' in response and response['response'] == 1:                 deleted_count += 1             else:                 error_count += 1                 print(f\"   \u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u0430 {post['id']}\")              time.sleep(1)          print(f\"\\n\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e:\")         print(f\"\u0423\u0441\u043f\u0435\u0448\u043d\u043e: {deleted_count}\")         print(f\"\u041e\u0448\u0438\u0431\u043e\u043a: {error_count}\")          return error_count == 0      def extract_text_from_posts(self, posts):         \"\"\"\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u043f\u043e\u0441\u0442\u043e\u0432\"\"\"         texts = []          for post in posts:             if 'text' in post and post['text'].strip():                 post_date = time.strftime('%Y-%m-%d %H:%M:%S',                                           time.localtime(post['date']))                 texts.append(f\"\u0414\u0430\u0442\u0430: {post_date}\\n\u0422\u0435\u043a\u0441\u0442: {post['text']}\\n{'-' * 50}\")          return texts      def save_posts_to_file(self, texts, filename='vk_posts.txt'):         \"\"\"\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\"\"\"         with open(filename, 'w', encoding='utf-8') as f:             f.write(f\"\u0412\u0441\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u0432: {len(texts)}\\n\")             f.write(\"=\" * 60 + \"\\n\\n\")             for text in texts:                 f.write(text + \"\\n\\n\")          print(f\"\u041f\u043e\u0441\u0442\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432 \u0444\u0430\u0439\u043b: {filename}\")   def main():     print(\"VK Parser - \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0430\u043c\u0438\")     print(\"=\" * 40)      login = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043b\u043e\u0433\u0438\u043d VK: \").strip()     password = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c VK: \").strip()      parser = VKParser(login, password)      if parser.login_vk():         while True:             print(\"\\n\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435:\")             print(\"1 - \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0441\u0442\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\")             print(\"2 - \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u043e\u0432\")             print(\"3 - \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0441\u0442\u044b (\u0411\u042b\u0421\u0422\u0420\u041e\u0415 \u041f\u041e\u0414\u0422\u0412\u0415\u0420\u0416\u0414\u0415\u041d\u0418\u0415)\")             print(\"4 - \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0441\u0442\u044b (\u041f\u041e\u0414\u0420\u041e\u0411\u041d\u041e\u0415 \u041f\u041e\u0414\u0422\u0412\u0415\u0420\u0416\u0414\u0415\u041d\u0418\u0415)\")             print(\"0 - \u0412\u044b\u0445\u043e\u0434\")              choice = input(\"\u0412\u0430\u0448 \u0432\u044b\u0431\u043e\u0440: \").strip()              if choice == \"1\":                 posts = parser.get_all_posts()                 if posts:                     post_texts = parser.extract_text_from_posts(posts)                     parser.save_posts_to_file(post_texts)                     print(f\"\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e {len(post_texts)} \u043f\u043e\u0441\u0442\u043e\u0432\")                 else:                     print(\"\u041f\u043e\u0441\u0442\u043e\u0432 \u043d\u0435\u0442 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f\")              elif choice == \"2\":                 posts = parser.get_all_posts()                 print(f\"\u0412\u0441\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0435\u043d\u0435: {len(posts)}\")              elif choice == \"3\":                 if parser.delete_all_posts():                     print(\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")                 else:                     print(\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438\")              elif choice == \"4\":                 if parser.delete_posts_with_confirmation():                     print(\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\")                 else:                     print(\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438\")              elif choice == \"0\":                 print(\"\u0412\u044b\u0445\u043e\u0434...\")                 break              else:                 print(\"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440\")   if __name__ == \"__main__\":     main()<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/articles\/939472\/\"> https:\/\/habr.com\/ru\/articles\/939472\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/shilvlad\/vk_post_managment\" rel=\"noopener noreferrer nofollow\">Python-\u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/a> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0435\u043d\u043e\u0439 VK. \u041d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 API. \u041d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0442\u0435\u043d\u043a\u0443 \u0432 \u0412\u041a. \u0416\u0438\u0437\u043d\u044c, \u0437\u043d\u0430\u0435\u0442\u0435 \u043b\u0438, \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u0430\u044f \u043d\u044b\u043d\u0447\u0435 \ud83d\ude42 \u041d\u043e, \u0432 \u0446\u0435\u043b\u043e\u043c, \u043c\u043d\u0435 \u0432\u0438\u0434\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0442\u0430\u043a \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u043e\u0434\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043e\u0446\u0441\u0435\u0442\u0438.<\/p>\n<h3>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h3>\n<ul>\n<li>\n<p>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 VK API<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u043b\u043e\u043c\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 VK API<\/h3>\n<p>VK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0449\u043d\u044b\u0439 API \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u043d\u0443\u0436\u0435\u043d\u00a0<strong>access token<\/strong>\u00a0\u2014 \u043a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u0430\u0432\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b API:<\/p>\n<ul>\n<li>\n<p><code>users.get<\/code>\u00a0\u2014 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435<\/p>\n<\/li>\n<li>\n<p><code>wall.get<\/code>\u00a0\u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441\u043e \u0441\u0442\u0435\u043d\u044b<\/p>\n<\/li>\n<li>\n<p><code>wall.delete<\/code>\u00a0\u2014 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/h3>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u043e \u041e\u041e\u041f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u00a0<code>VKParser<\/code>\u00a0\u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API:<\/p>\n<pre><code class=\"python\">class VKParser:     def init(self, login, password):     self.login = login     self.password = password     self.session = requests.Session()     self.access_token = None     self.user_id = None<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u00a0<code>requests.Session()<\/code>\u00a0\u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f cookies \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<h3>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438<\/h3>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 access token<\/h4>\n<p>\u041f\u0440\u044f\u043c\u043e\u0439 \u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c \u0432 VK API \u0434\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043f\u043e\u0441\u0435\u043c\u0443, \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c token \u0447\u0435\u0440\u0435\u0437 OAuth:<\/p>\n<pre><code class=\"python\">def login_vk(self):     auth_url = \"https:\/\/oauth.vk.com\/authorize\"     auth_params = {         'client_id': '6121396',  # Standalone app ID         'redirect_uri': 'https:\/\/oauth.vk.com\/blank.html',         'display': 'page',         'scope': 'wall,offline',  # Requested permissions         'response_type': 'token',         'v': '5.131'  # API version     }          # Generate auth URL     auth_link = f\"{auth_url}?{'&amp;'.join([f'{k}={v}' for k, v in auth_params.items()])}\"     print(f\"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: {auth_link}\")<\/code><\/pre>\n<h4>\u041f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (scope)<\/h4>\n<ul>\n<li>\n<p><code>wall<\/code>\u00a0\u2014 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0442\u0435\u043d\u0435 (\u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p><code>offline<\/code>\u00a0\u2014 \u0431\u0435\u0441\u0441\u0440\u043e\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0431\u0435\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><code>groups<\/code>\u00a0\u2014 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0433\u0440\u0443\u043f\u043f\u0430\u043c (\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e)<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439<\/h3>\n<p>VK API \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u044b \u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438 (\u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e 100 \u0437\u0430 \u0437\u0430\u043f\u0440\u043e\u0441), \u0441 \u0447\u0435\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u0442\u0438\u043c\u0438\u0448\u0432\u0438\u043b\u0438. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043e\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">def get_all_posts(self):     all_posts = []     offset = 0     count = 100  # Max per request          while True:         response = self._make_api_request('wall.get', {             'owner_id': self.user_id,             'count': count,             'offset': offset         })                  posts = response['response']['items']         if not posts:             break                      all_posts.extend(posts)         offset += count                  time.sleep(0.5)  # Rate limiting                  if len(posts) &lt; count:             break          return all_posts<\/code><\/pre>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 rate limits<\/h4>\n<p>\u0412\u0430\u0436\u043d\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043b\u0438\u043c\u0438\u0442\u044b VK API (1000 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u0442\u0435\u043d\u044b \u0443\u0434\u0430\u043b\u044f\u043b\u0438\u0441\u044c \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e):<\/p>\n<ul>\n<li>\n<p>3 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u00a0<code>time.sleep(0.5)<\/code>\u00a0\u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h3>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430<\/h3>\n<h4>\u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 \u2014 \u043d\u0435\u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0443\u0442 \u0442\u0440\u043e\u0439\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u043a\u043e\u0434\u043e\u043c. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430:<\/p>\n<pre><code class=\"python\">def delete_posts_with_confirmation(self):     print(\"\u26a0\ufe0f  \u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415! \u042d\u0422\u0410 \u041e\u041f\u0415\u0420\u0410\u0426\u0418\u042f \u041d\u0415\u041e\u0411\u0420\u0410\u0422\u0418\u041c\u0410! \u26a0\ufe0f\")          confirmation1 = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 'DELETE MY POSTS' \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f: \")     if confirmation1 != \"DELETE MY POSTS\":         return False          confirmation2 = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 'YES I AM SURE' \u0434\u043b\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f: \")     if confirmation2 != \"YES I AM SURE\":         return False          return self._delete_posts(posts)<\/code><\/pre>\n<h4>\u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u043e\u0442\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u044c\u044e<\/h4>\n<pre><code class=\"python\">def _delete_posts(self, posts):     deleted_count = 0     error_count = 0          for i, post in enumerate(posts, 1):         response = self._make_api_request('wall.delete', {             'owner_id': self.user_id,             'post_id': post['id']         })                  if response and response['response'] == 1:             deleted_count += 1         else:             error_count += 1                  time.sleep(1)  # Important delay          print(f\"\u0423\u0441\u043f\u0435\u0448\u043d\u043e: {deleted_count}, \u041e\u0448\u0438\u0431\u043e\u043a: {error_count}\")     return error_count == 0<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b<\/h4>\n<pre><code class=\"python\">parser = VKParser(\"your_login\", \"your_password\")  # \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f if parser.login_vk():     # \u041f\u041e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u044b     posts = parser.get_all_posts()     print(f\"\u041d\u0430\u0439\u0434\u0435\u043d\u043e {len(posts)} \u043f\u043e\u0441\u0442\u043e\u0432\")          # \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u0430     parser.save_posts_to_file(posts)          # \u0423\u0434\u0430\u043b\u044f\u0435\u043c (\u0441 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c)     parser.delete_posts_with_confirmation()<\/code><\/pre>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043e\u043b\u043e\u043c\u043a\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0444\u0430\u043a\u0430\u043f\u0430<\/h3>\n<h4>1. \u0411\u044d\u043a\u0430\u043f \u043f\u0435\u0440\u0435\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c<\/h4>\n<p>\u0412\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0439\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u043b\u044e\u0431\u044b\u043c\u0438 destructive-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"python\">def save_posts_to_file(self, texts, filename='vk_posts.txt'):     with open(filename, 'w', encoding='utf-8') as f:         f.write(f\"\u0412\u0441\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u0432: {len(texts)}\\n\")         for text in texts:             f.write(text + \"\\n\\n\")<\/code><\/pre>\n<h4>2. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a API<\/h4>\n<pre><code class=\"python\">def _make_api_request(self, method, params):     try:         response = self.session.get(             f'https:\/\/api.vk.com\/method\/{method}',             params=params,             timeout=30         )         data = response.json()                  if 'error' in data:             print(f\"API Error: {data['error']['error_msg']}\")             return None                      return data     except Exception as e:         print(f\"Request failed: {e}\")         return None<\/code><\/pre>\n<h4>3. \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u043e\u0432<\/h4>\n<p>\u0412 \u043a\u043e\u0434\u0435, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432\/\u0442\u043e\u043a\u0435\u043d\u043e\u0432\/\u043f\u0430\u0440\u043e\u043b\u0435\u0439! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">import os  token = os.getenv('VK_ACCESS_TOKEN') if not token:     token = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 access token: \")<\/code><\/pre>\n<h3>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f, \u043d\u043e, \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u0441 \u0447\u0435\u043c \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438. \u0422\u0443\u0442 \u043d\u0430\u043c \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 JSON, XML \u0438 \u0442\u0434, \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u043e\u0447\u0435\u0435.<\/p>\n<p><em>\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u043d\u0435\u0441\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/em><\/p>\n<p><em>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <\/em><a href=\"https:\/\/github.com\/shilvlad\/vk_post_managment\" rel=\"noopener noreferrer nofollow\"><em>GitHub<\/em><\/a><em> \u0438 \u043d\u0438\u0436\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/em><\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import requests import json import time   class VKParser:     def __init__(self, login, password):         self.login = login         self.password = password         self.session = requests.Session()         self.access_token = None         self.user_id = None      def login_vk(self):         \"\"\"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 VK\"\"\"         print(\"\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e...\")          # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438         auth_url = \"https:\/\/oauth.vk.com\/authorize\"         auth_params = {             'client_id': '6121396',             'redirect_uri': 'https:\/\/oauth.vk.com\/blank.html',             'display': 'page',             'scope': 'wall,offline,groups',  # \u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u0430 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f             'response_type': 'token',             'v': '5.131'         }          print(\"\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c access_token\")         print(\"\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0435\u0433\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435:\")         print(f\"{auth_url}?{'&amp;'.join([f'{k}={v}' for k, v in auth_params.items()])}\")         print(\"\\n\u041f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 access_token \u0438\u0437 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\")          self.access_token = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 access_token: \").strip()          if self.access_token:             user_info = self._make_api_request('users.get', {})             if user_info and 'response' in user_info:                 self.user_id = user_info['response'][0]['id']                 print(f\"\u0423\u0441\u043f\u0435\u0448\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f! User ID: {self.user_id}\")                 return True             else:                 print(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0442\u043e\u043a\u0435\u043d.\")                 return False         return False      def _make_api_request(self, method, params):         \"\"\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a VK API\"\"\"         params['access_token'] = self.access_token         params['v'] = '5.131'          try:             response = self.session.get(                 f'https:\/\/api.vk.com\/method\/{method}',                 params=params,                 timeout=30             )             return response.json()         except Exception as e:             print(f\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a API: {e}\")             return None      def get_all_posts(self):         \"\"\"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441\u043e \u0441\u0442\u0435\u043d\u044b\"\"\"         if not self.access_token:             print(\"\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e!\")             return []          print(\"\u041d\u0430\u0447\u0438\u043d\u0430\u044e \u0441\u0431\u043e\u0440 \u043f\u043e\u0441\u0442\u043e\u0432...\")         all_posts = []         offset = 0         count = 100          while True:             print(f\"\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u044e \u043f\u043e\u0441\u0442\u044b, offset: {offset}\")              response = self._make_api_request('wall.get', {                 'owner_id': self.user_id,                 'count': count,                 'offset': offset             })              if not response or 'response' not in response:                 print(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u0432\")                 break              posts = response['response']['items']             if not posts:                 break              all_posts.extend(posts)             offset += count              time.sleep(0.5)              if len(posts) &lt; count:                 break          return all_posts      def delete_all_posts(self):         \"\"\"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441\u043e \u0441\u0442\u0435\u043d\u044b\"\"\"         if not self.access_token:             print(\"\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e!\")             return False          print(\"\u26a0\ufe0f  \u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415! \u042d\u0422\u0410 \u041e\u041f\u0415\u0420\u0410\u0426\u0418\u042f \u041d\u0415\u041e\u0411\u0420\u0410\u0422\u0418\u041c\u0410! \u26a0\ufe0f\")         print(\"\u0412\u0441\u0435 \u043f\u043e\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0431\u0435\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f!\")          confirmation = input(\"\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b? (\u0432\u0432\u0435\u0434\u0438\u0442\u0435 'DELETE ALL' \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f): \")         if confirmation != \"DELETE ALL\":             print(\"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u0430.\")             return False          posts = self.get_all_posts()         if not posts:             print(\"\u041f\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0442.\")             return True<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-471533","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471533","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=471533"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471533\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=471533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=471533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=471533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}