{"id":229793,"date":"2014-07-15T10:57:03","date_gmt":"2014-07-15T06:57:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=229793"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=229793","title":{"rendered":"<span class=\"post_title\">\u0410\u043d\u0430\u043b\u0438\u0437 \u0434\u0440\u0443\u0436\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439 VK \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python. \u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f. \u0414\u0440\u0443\u0437\u044c\u044f \u0434\u0440\u0443\u0437\u0435\u0439<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 <a href=\"http:\/\/habrahabr.ru\/post\/221251\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0449\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0433\u0440\u0430\u0444, \u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0440\u0443\u0437\u0435\u0439, \u0434\u0440\u0443\u0437\u0435\u0439 \u0434\u0440\u0443\u0437\u0435\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0443\u0436\u0435 \u043f\u0440\u043e\u0447\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e <a href=\"http:\/\/habrahabr.ru\/post\/221251\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043d\u043e\u0432\u043e.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0441\u0435 id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e, \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0445 id \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/vk.com\/catalog.php\">\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/a>. \u041d\u0430\u0448\u0430 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0440\u0443\u0437\u0435\u0439 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u0438 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0441\u043a\u043e\u043b\u044c \u0443\u0433\u043e\u0434\u043d\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u043e, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b. <\/p>\n<p>  \u041a\u043e\u0434, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u043e\u043b\u0435\u0435 \u0441\u0432\u0435\u0436\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0442\u043e\u043c \u0436\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/stleon\/vk_friends\">Github<\/a>. <\/p>\n<p>  \u041a\u0430\u043a \u0431\u0443\u0434\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c:  <\/p>\n<ul>\n<li>\u0417\u0430\u0434\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/li>\n<li>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043b\u0438\u0431\u043e \u0442\u0435 id, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u0435<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442<\/li>\n<\/ul>\n<p>  \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:  <\/p>\n<ul>\n<li>Python 3.4<\/li>\n<li>\u0425\u0440\u0430\u043d\u0438\u043c\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0432 \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0417\u0430\u0434\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/h4>\n<p>  \u0427\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u2014 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0433\u043b\u0443\u0431\u0438\u043d\u0443 (<b>deep<\/b>), \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0432 <i>main.py<\/i>:<\/p>\n<pre><code class=\"python\">print(a.deep_friends(2)) # \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0442\u0430\u043c \u0443\u0436\u0435 \u0435\u0441\u0442\u044c <\/code><\/pre>\n<p>  <b>deep<\/b> \u0440\u0430\u0432\u043d\u043e\u0435 1 \u2014 \u044d\u0442\u043e \u043d\u0430\u0448\u0438 \u0434\u0440\u0443\u0437\u044c\u044f, 2 \u2014 \u044d\u0442\u043e \u0434\u0440\u0443\u0437\u044c\u044f \u043d\u0430\u0448\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u2014 \u0438\u0445 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0440\u0443\u0437\u0435\u0439. <\/p>\n<p>  \u041d\u0435 \u0441\u043f\u0435\u0448\u0438\u0442\u0435 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u044b. \u041f\u0440\u0438 14 \u043c\u043e\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0440\u0443\u0437\u044c\u044f\u0445 \u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0435 \u0440\u0430\u0432\u043d\u043e\u0439 2, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u044e\u0447\u0435\u0439 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e 2427, \u0430 \u043f\u0440\u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0435 \u0440\u0430\u0432\u043d\u043e\u0439 3, \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u044f \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b 223.908 \u043a\u043b\u044e\u0447\u0435\u0439. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0433\u0440\u0430\u0444, \u0432\u0435\u0434\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u044e\u0447\u0438, \u0430 \u0440\u0435\u0431\u0440\u0430\u043c\u0438 \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0414\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0443\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/vk.com\/dev\/friends.get\">friends.get<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u0432 \u0445\u0440\u0430\u043d\u0438\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435, \u0438\u043c\u0435\u044e\u0449\u0435\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"javascript\">var targets = Args.targets; var all_friends = {}; var req; var parametr = &quot;&quot;; var start = 0; \/\/ \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0446\u0435\u043b\u044f\u043c\u0438 \u0432\u044b\u043d\u0438\u043c\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0446\u0435\u043b\u044c while(start&lt;=targets.length){     if (targets.substr(start, 1) != &quot;,&quot; && start != targets.length){         parametr = parametr + targets.substr(start, 1);     }     else {         \/\/ \u0441\u0440\u0430\u0437\u0443 \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u043b\u0438 id         req = API.friends.get({&quot;user_id&quot;:parametr});         if (req) {             all_friends = all_friends + [req];         }         else {             all_friends = all_friends + [0];         }         parametr = &quot;&quot;;     }     start = start + 1; } return all_friends; <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043c\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 <a href=\"https:\/\/vk.com\/editapp?id=ID\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f&amp;section=functions\">\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/a>, \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043e\u043d\u0430 \u043d\u0430 <b>VkScript<\/b>, \u043a\u0430\u043a \u0438 <b>execute<\/b>, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c <a href=\"https:\/\/vk.com\/dev\/execute\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/vk.com\/pages.php?o=-1&amp;p=execute\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041c\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 25 id, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438, \u0432\u044b\u043d\u0438\u043c\u0430\u0435\u043c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 id, \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a <b>friends.get<\/b>, \u0430 \u043d\u0443\u0436\u043d\u0430\u044f \u043d\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435, \u0433\u0434\u0435 \u043a\u043b\u044e\u0447\u0438 \u2014 \u044d\u0442\u043e id, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0440\u0443\u0437\u0435\u0439 \u0434\u0430\u043d\u043d\u043e\u0433\u043e id.<\/p>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0445\u0440\u0430\u043d\u0438\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0440\u0443\u0437\u0435\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, id \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445. \u0421\u043f\u0438\u0441\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0435\u0439 (N\/25 \u2014 \u044d\u0442\u043e \u0438 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432), \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u044d\u0442\u043e \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a API \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435. <\/p>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430<\/h4>\n<p>  \u0412\u0441\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">{1:(0, 2, 3, 4), 2: (0, 1, 3, 4), 3: (0, 1, 2)} <\/code><\/pre>\n<p>  \u041a\u043b\u044e\u0447\u0438 1, 2 \u0438 3 \u0431\u044b\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043f\u0440\u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0435 \u0440\u0430\u0432\u043d\u043e\u0439 1. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0438 \u0431\u044b\u043b\u0438 \u0432\u0441\u0435 \u0434\u0440\u0443\u0437\u044c\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (0). <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 1, \u0442\u043e \u0434\u0430\u043b\u0435\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u043f\u0435\u0440\u0432\u043e\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u2014 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0435 id (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 0 \u0438 4), \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u0432 \u043a\u043b\u044e\u0447\u0430\u0445, \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u0438\u0445 \u043e\u043f\u044f\u0442\u044c \u043d\u0430 25 \u0447\u0430\u0441\u0442\u0435\u0439 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0445\u0440\u0430\u043d\u0438\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435.<\/p>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f 2 \u043d\u043e\u0432\u044b\u0445 \u043a\u043b\u044e\u0447\u0430:<\/p>\n<pre><code class=\"python\">{1:(0, 2, 3, 4), 2: (0, 1, 3, 4), 3: (0, 1, 2), 0: (1, 2, 3), 4:(1, 2, \u2026.)} <\/code><\/pre>\n<p>  \u0421\u0430\u043c \u0436\u0435 \u043c\u0435\u0442\u043e\u0434 <b>deep_friends()<\/b> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">def deep_friends(self, deep): \t\tresult = {}  \t\tdef fill_result(friends): \t\t\tfor i in VkFriends.parts(friends): \t\t\t\tr = requests.get(self.request_url('execute.deepFriends', 'targets=%s' % VkFriends.make_targets(i))).json()['response'] \t\t\t\tfor x, id in enumerate(i): \t\t\t\t\tresult[id] = tuple(r[x][&quot;items&quot;]) if r[x] else None  \t\tfor i in range(deep): \t\t\tif result: \t\t\t\t# \u0442\u0435 \u0430\u0439\u0434\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u0432 \u043a\u043b\u044e\u0447\u0430\u0445 + \u043d\u0435 \u0431\u0435\u0440\u0435\u043c id:None \t\t\t\tfill_result(list(set([item for sublist in result.values() if sublist for item in sublist]) - set(result.keys()))) \t\t\telse: \t\t\t\tfill_result(requests.get(self.request_url('friends.get', 'user_id=%s' % self.my_id)).json()['response'][&quot;items&quot;])  \t\treturn result <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043a\u0438\u0434\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 id \u0432 <b>friends.get<\/b> \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b, \u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. <\/p>\n<h4>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0415\u0441\u043b\u0438 \u0431\u044b <b>friends.get<\/b> \u0431\u044b\u043b \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 <b>users.get<\/b>, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u043e\u0433 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <b>user_ids<\/b>, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e id, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0440\u0443\u0437\u0435\u0439, \u0430 \u043d\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 id, \u0442\u043e \u043a\u043e\u0434 \u0431\u044b\u043b \u0431\u044b \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435, \u0434\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u044b\u043b\u043e \u0432 \u0440\u0430\u0437\u044b \u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441 \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f.      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/229793\/\"> http:\/\/habrahabr.ru\/post\/229793\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 <a href=\"http:\/\/habrahabr.ru\/post\/221251\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0449\u0438\u0445 \u0434\u0440\u0443\u0437\u0435\u0439 \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0433\u0440\u0430\u0444, \u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0440\u0443\u0437\u0435\u0439, \u0434\u0440\u0443\u0437\u0435\u0439 \u0434\u0440\u0443\u0437\u0435\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0443\u0436\u0435 \u043f\u0440\u043e\u0447\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e <a href=\"http:\/\/habrahabr.ru\/post\/221251\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043d\u043e\u0432\u043e.  <\/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-229793","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/229793","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=229793"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/229793\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=229793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=229793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=229793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}