{"id":307295,"date":"2020-07-22T09:00:11","date_gmt":"2020-07-22T09:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307295"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307295","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u043b\u0438\u0446 \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u0445 \u0438\u0437 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512002\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ee\/tf\/nz\/eetfnz8dwbhofyvt-kupfwbwmkk.png\"\/><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d \u043e\u043f\u044b\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u043b\u0438\u0446, \u0434\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u0441\u0435\u0445 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u0438\u0437 \u0431\u0435\u0441\u0435\u0434\u044b \u0412\u041a \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u0411\u0435\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u043e\u043f\u044b\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438 Python.<a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0415\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0434\u0440\u0443\u0433, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u043e\u0432\u0443\u0442 \u0421\u0435\u0440\u0433\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u0438\u0442 \u0441\u0435\u0431\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043e\u0431\u0440\u0430\u0437\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0431\u0435\u0441\u0435\u0434\u0443, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0444\u0438\u0440\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0444\u0440\u0430\u0437\u0430\u043c\u0438. \u0422\u0430\u043a \u0432\u043e\u0442 \u0432 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0435\u0447\u0435\u0440\u043e\u0432 \u0432 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043c\u044b\u0441\u043b\u044c \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u0431\u043b\u0438\u043a \u0432 \u0432\u043a, \u043a\u0443\u0434\u0430 \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u043e\u0441\u0442\u0438\u0442\u044c \u0421\u0435\u0440\u0433\u0435\u044f \u0441 \u0435\u0433\u043e \u0446\u0438\u0442\u0430\u0442\u0430\u043c\u0438. \u041f\u0435\u0440\u0432\u044b\u0435 10 \u043f\u043e\u0441\u0442\u043e\u0432 \u0432 \u043e\u0442\u043b\u043e\u0436\u043a\u0443 \u0434\u0430\u043b\u0438\u0441\u044c \u043b\u0435\u0433\u043a\u043e, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438 \u0432\u0441\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0435\u0441\u0435\u0434\u0435 \u2014 \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430. \u0422\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<h2>\u041f\u043b\u0430\u043d<\/h2>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0438\u0437 \u0431\u0435\u0441\u0435\u0434\u044b<\/li>\n<li>\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438<\/li>\n<li>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/li>\n<\/ol>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0435\u0449\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Python \u0438 pip. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 0, \u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438<\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h3>1. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438<\/h3>\n<p>  \u0422\u0430\u043a \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0441 \u0431\u0435\u0441\u0435\u0434\u044b \u043d\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043c\u0435\u0442\u043e\u0434 <b>messages.getHistoryAttachments<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0438\u043b\u0438 \u0431\u0435\u0441\u0435\u0434\u044b.<\/p>\n<blockquote><p>\u0421 15 \u0444\u0435\u0432\u0440\u0430\u043b\u044f 2019 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u043a <b>messages<\/b>, \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0435 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u043c\u043e\u0434\u0435\u0440\u0430\u0446\u0438\u044e. \u0418\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0431\u0445\u043e\u0434\u0430 \u043c\u043e\u0433\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c <a href=\"http:\/\/vkhost.github.io\">vkhost<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u043e\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u043e\u0432<\/p><\/blockquote>\n<p>  \u0421 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u043d\u0430 vkhost \u043c\u043e\u0436\u0435\u043c, \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a API, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <a href=\"https:\/\/www.postman.com\/\">Postman<\/a>. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u0432\u0441\u0451 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0443\u0447\u043a\u0430\u043c\u0438, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/z2\/ed\/ot\/z2edotb4l7bif_ib6ksjud-lpee.png\"\/><\/p>\n<p>  <b>\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/b>  <\/p>\n<ul>\n<li> peer_id \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<br \/>\n<blockquote><p>\u0414\u043b\u044f \u0431\u0435\u0441\u0435\u0434\u044b: 2000000000 + id \u0431\u0435\u0441\u0435\u0434\u044b (\u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435).<br \/>  \u0414\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f: id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p><\/blockquote>\n<\/li>\n<li>media_type \u2014 \u0442\u0438\u043f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432<br \/>\n<blockquote><p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 photo<\/p><\/blockquote>\n<\/li>\n<li>start_from \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>\n<blockquote><p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043f\u0443\u0441\u0442\u044b\u043c<\/p><\/blockquote>\n<\/li>\n<li>count \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<br \/>\n<blockquote><p>\u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 200, \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/p><\/blockquote>\n<\/li>\n<li>photo_sizes \u2014 \u0444\u043b\u0430\u0433 \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435<br \/>\n<blockquote><p>1 \u0438\u043b\u0438 0. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c 1<\/p><\/blockquote>\n<\/li>\n<li>preserve_order \u2014 \u0444\u043b\u0430\u0433 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435<br \/>\n<blockquote><p>1 \u0438\u043b\u0438 0. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c 1<\/p><\/blockquote>\n<\/li>\n<li>v \u2014 \u0432\u0435\u0440\u0441\u0438\u044f vk api<br \/>\n<blockquote><p>1 \u0438\u043b\u0438 0. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c 1<\/p><\/blockquote>\n<\/li>\n<\/ul>\n<p>  <b>\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0432 Postman<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/60\/ct\/lx\/60ctlxo79pa-vrhl8dkg_nrq0ec.png\"\/><\/p>\n<p>  <b>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430<\/b>  <\/p>\n<blockquote><p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432<\/p><\/blockquote>\n<p>  \u0411\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <b>json <\/b>(\u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445) \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <b>requests<\/b> (\u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c http \u0437\u0430\u043f\u0440\u043e\u0441\u044b)<\/p>\n<p>  \u041b\u0438\u0441\u0442\u0438\u043d\u0433 \u043a\u043e\u0434\u0430 \u0435\u0441\u043b\u0438 \u0432 \u0431\u0435\u0441\u0435\u0434\u0435\/\u0434\u0438\u0430\u043b\u043e\u0433\u0435 <b>\u043c\u0435\u043d\u0435\u0435 200 <\/b> \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 <\/p>\n<pre><code class=\"python\">import json import requests  val = 1 # \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430  Fin = open(&quot;input.txt&quot;,&quot;a&quot;) # \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0441\u044b\u043b\u043e\u043a # \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c GET \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 API \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u0432 response response = requests.get(&quot;https:\/\/api.vk.com\/method\/messages.getHistoryAttachments?peer_id=2000000078&media_type=photo&start_from=&count=10&photo_size=1&preserve_order=1&max_forwards_level=45&v=5.103&access_token=\u0412\u0410\u0428_\u0422\u041e\u041a\u0415\u041d&quot;) items = json.loads(response.text) # \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON  # \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043e GET \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u043e\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445, \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0446\u0438\u043a\u043b\u043e\u043c  for item in items['response']['items']: # \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 items     link = item['attachment']['photo']['sizes'][-1]['url'] # \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f     print(val,':',link) # \u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043b\u043e\u0433 \u043f\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435     Fin.write(str(link)+&quot;\\n&quot;) # \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0444\u0430\u0439\u043b     val += 1 # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 <b>\u0431\u043e\u043b\u0435\u0435 200<\/b> <\/p>\n<pre><code class=\"python\">import json import requests  next = None # \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f def newfunc():     val = 1 # \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430     global next     Fin = open(&quot;input.txt&quot;,&quot;a&quot;) # \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0441\u044b\u043b\u043e\u043a     # \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c GET \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 API \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u0432 response     response = requests.get(f&quot;https:\/\/api.vk.com\/method\/messages.getHistoryAttachments?peer_id=2000000078&media_type=photo&start_from={next}&count=200&photo_size=1&preserve_order=1&max_forwards_level=44&v=5.103&access_token=\u0412\u0410\u0428_\u0422\u041e\u041a\u0415\u041d&quot;)     items = json.loads(response.text) # \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON      if items['response']['items'] != []: # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435         for item in items['response']['items']: # \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 items             link = item['attachment']['photo']['sizes'][-1]['url'] # \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f             print(val,':',link) # \u041b\u043e\u0433 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439             val += 1 # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430             Fin.write(str(link)+&quot;\\n&quot;) # \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0444\u0430\u0439\u043b         next = items['response']['next_from'] # \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439         print('dd',items['response']['next_from'])         newfunc() # \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e     else: # \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445         print(&quot;\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u0441\u0435 \u0444\u043e\u0442\u043e&quot;)  newfunc()<\/code><\/pre>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u043e\u0440\u0430 \u043a\u0430\u0447\u0430\u0442\u044c<\/p>\n<h2>2. \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/h2>\n<p>  \u0414\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 urllib<\/p>\n<pre><code class=\"python\">import urllib.request  f = open('input.txt') # \u041d\u0430\u0448 \u0444\u0430\u0439\u043b \u0441 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438  val = 1 # \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 for line in f: # \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e     line = line.rstrip('\\n')     # \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043f\u043a\u0443 &quot;img&quot;     urllib.request.urlretrieve(line, f&quot;img\/{val}.jpg&quot;)     print(val,':','\u0441\u043a\u0430\u0447\u0430\u043d') # \u0412 \u043b\u043e\u0433\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435     val += 1 # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0447\u0451\u0442\u0447\u0438\u043a print(&quot;\u0413\u043e\u0442\u043e\u0432\u043e&quot;) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0441\u0435\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0435\u0441\u043b\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 8330. \u041c\u0435\u0441\u0442\u043e \u043f\u043e\u0434 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0442\u043e\u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043a\u0430\u043a \u0443 \u043c\u0435\u043d\u044f \u0438 \u0431\u043e\u043b\u0435\u0435, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0434 \u044d\u0442\u043e <b>1,5 \u2014 2 \u0413\u0431<\/b><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mn\/bd\/mq\/mnbdmq1vdohhetaccuclhdmpunq.png\"\/><\/p>\n<p>  \u0427\u0435\u0440\u043d\u043e\u0432\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 <\/p>\n<h2>3. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438<\/h2>\n<p>  \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <br \/>  <a href=\"https:\/\/github.com\/ageitgey\/face_recognition\">Face Recognition<\/a><\/p>\n<h3>\u0427\u0442\u043e \u0443\u043c\u0435\u0435\u0442 ?<\/h3>\n<p>  \u0418\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0430\u043c\u044b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/p>\n<p>  <b>\u041f\u043e\u0438\u0441\u043a \u043b\u0438\u0446 \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u0445 <\/b><br \/>  \u041c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u0438\u0446 \u043d\u0430 \u0444\u043e\u0442\u043e, \u0434\u0430\u0436\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u043c\u0438<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ni\/uk\/a_\/niuka_10-oblsdue1eisymce32e.png\"\/><\/p>\n<p>  <b>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043b\u0438\u0446 \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438<\/b><br \/>  \u041c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043b\u0438\u0446\u043e \u043d\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ur\/4h\/11\/ur4h11jsx_pj3c_w6xpn3vkdrds.png\"\/><\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0441 \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f <b>\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043b\u0438\u0446<\/b> <\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h3>\n<p>  \u0418\u0437 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c <b>Python 3.3+<\/b> \u0438\u043b\u0438 <b>Python 2.7<\/b><br \/>  \u041f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2014 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0448\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u0430\u044f <b>Face Recognition<\/b> \u0438 <b>PIL<\/b> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<blockquote><p>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <b>Face Recognition<\/b> \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <b>Windows<\/b>, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u0421 macOS \u0438 Linux \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e.<\/p><\/blockquote>\n<h3>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e<\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0430\u044f \u0441\u0432\u0435\u0440\u043a\u0430 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439.   <\/p>\n<blockquote><p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0447\u0451\u0442\u043a\u0443\u044e \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0432 \u0430\u043d\u0444\u0430\u0441<\/p><\/blockquote>\n<p>\u041f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0447\u0435\u0440\u0442 \u043b\u0438\u0446\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 (\u043d\u043e\u0441, \u0433\u043b\u0430\u0437\u0430, \u0440\u043e\u0442 \u0438 \u043f\u043e\u0434\u0431\u043e\u0440\u043e\u0434\u043e\u043a)<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/19\/bu\/w5\/19buw5org5lcbb83pusfnne9suo.png\"\/><\/p>\n<p>  \u041d\u0443, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c, \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0442\u0438\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u043d\u0430\u0448\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0430\u0451\u043c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0447\u0435\u0440\u0442\u044b \u043b\u0438\u0446 \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c. <\/p>\n<p>  <b>\u041d\u0443 \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c \u043a\u043e\u0434:<\/b><\/p>\n<pre><code class=\"python\">import face_recognition from PIL import Image # \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438  find_face = face_recognition.load_image_file(&quot;face\/sergey.jpg&quot;) # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 face_encoding = face_recognition.face_encodings(find_face)[0] # \u041a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0435\u0440\u0442\u044b \u043b\u0438\u0446\u0430, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438  i = 0 # \u0421\u0447\u0451\u0442\u0447\u0438\u043a \u043e\u0431\u0449\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f done = 0 # \u0421\u0447\u0451\u0442\u0447\u0438\u043a \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 numFiles = 8330 # \u0422\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u0444\u043e\u0442\u043e while i != numFiles:     i += 1 # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043e\u0431\u0449\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f     unknown_picture = face_recognition.load_image_file(f&quot;img\/{i}.jpg&quot;) # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435     unknown_face_encoding = face_recognition.face_encodings(unknown_picture) # \u041a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0435\u0440\u0442\u044b \u043b\u0438\u0446\u0430      pil_image = Image.fromarray(unknown_picture) # \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e      # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u0448\u043b\u0430 \u043b\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043b\u0438\u0446\u043e     if len(unknown_face_encoding) &gt; 0: # \u0415\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 \u043b\u0438\u0446\u043e         encoding = unknown_face_encoding[0] # \u041e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a 0 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c         results = face_recognition.compare_faces([face_encoding], encoding) # \u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u043b\u0438\u0446\u0430          if results[0] == True: # \u0415\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e             done += 1 # \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043e\u0431\u0449\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f             print(i,&quot;-&quot;,&quot;\u041d\u0430\u0448\u043b\u0438 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 !&quot;)             pil_image.save(f&quot;done\/{int(done)}.jpg&quot;) # \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0444\u043e\u0442\u043e \u0441 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c         else: # \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e             print(i,&quot;-&quot;,&quot;\u041d\u0435 \u043d\u0430\u0448\u043b\u0438 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430!&quot;)     else: # \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u043b\u0438\u0446\u043e         print(i,&quot;-&quot;,&quot;\u041b\u0438\u0446\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e!&quot;) <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0432\u0441\u0451 \u043f\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u043d\u043e\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043d\u0430 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>model= \u00abcnn\u00bb<\/b> \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430:<\/p>\n<pre><code class=\"python\">    unknown_picture = face_recognition.load_image_file(f&quot;img\/{i}.jpg&quot;) # \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435     face_locations = face_recognition.face_locations(unknown_picture, model= &quot;cnn&quot;) # \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 GPU     unknown_face_encoding = face_recognition.face_encodings(unknown_picture) # \u041a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0435\u0440\u0442\u044b \u043b\u0438\u0446\u0430<\/code><\/pre>\n<p>  <\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<p>  <b>\u0411\u0435\u0437 GPU. <\/b>\u041f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u043b\u0430 \u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0430 <b>8330 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 <\/b> \u0437\u0430 <b>1 \u0447\u0430\u0441 40 \u043c\u0438\u043d\u0443\u0442<\/b> \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0448\u043b\u0430 <b>142 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 <\/b> \u0438\u0437 \u043d\u0438\u0445 <b>62 <\/b>\u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0431\u044b\u0432\u0430\u043b\u0438 \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u043d\u0430 \u043c\u0435\u043c\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043b\u044e\u0434\u0435\u0439.<\/p>\n<p>  <b>C GPU.<\/b> \u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043d\u044f\u043b\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435, <b>17 \u0447\u0430\u0441\u043e\u0432 \u0438 22 \u043c\u0438\u043d\u0443\u0442\u044b <\/b> \u0438 \u043d\u0430\u0448\u043b\u0430 <b>230 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439<\/b> \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 <b>99<\/b> \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a.<\/p>\n<p>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435 \u0437\u0440\u044f. \u041c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 8330 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439, \u0447\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u043c\u0443<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 <b><a href=\"https:\/\/github.com\/digtaltech\/VK-Photo-AI\">github<\/a><\/b><\/div>\n<p> \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\/512002\/\"> https:\/\/habr.com\/ru\/post\/512002\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512002\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ee\/tf\/nz\/eetfnz8dwbhofyvt-kupfwbwmkk.png\"\/><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d \u043e\u043f\u044b\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u043b\u0438\u0446, \u0434\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u0441\u0435\u0445 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u0438\u0437 \u0431\u0435\u0441\u0435\u0434\u044b \u0412\u041a \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u0411\u0435\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u043e\u043f\u044b\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438 Python.<\/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-307295","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307295","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=307295"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307295\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}