{"id":219875,"date":"2014-04-18T13:13:03","date_gmt":"2014-04-18T09:13:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=219875"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=219875","title":{"rendered":"<span class=\"post_title\">\u0418\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 AJAX-\u0441\u0430\u0439\u0442\u043e\u0432<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u0435 AJAX \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c, \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u0430\u043c\u0438. \u0423 \u042f\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 Google \u0435\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 (<a href=\"https:\/\/developers.google.com\/webmasters\/ajax-crawling\/\">https:\/\/developers.google.com\/webmasters\/ajax-crawling\/<\/a> <a href=\"http:\/\/help.yandex.ru\/webmaster\/robot-workings\/ajax-indexing.xml\">http:\/\/help.yandex.ru\/webmaster\/robot-workings\/ajax-indexing.xml<\/a>). \u0421\u0443\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0443 \u043e HTML \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0432 \u0442\u0435\u043b\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0435\u0433 <code>&lt;meta name=&quot;fragment&quot; content=&quot;!&quot;&gt;<\/code>. \u042d\u0442\u043e\u0442 \u0442\u0435\u0433 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 AJAX \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445. HTML \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/www.example.com\/\u0447\u0442\u043e\u0442\u043e\u0435\u0449\u0435?_escaped_fragment_=\">www.example.com\/\u0447\u0442\u043e\u0442\u043e\u0435\u0449\u0435?_escaped_fragment_=<\/a>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 <a href=\"http:\/\/widjer.net\/posts\/posts-430033\">http:\/\/widjer.net\/posts\/posts-430033<\/a>, \u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0430\u0434\u0440\u0435\u0441 <a href=\"http:\/\/widjer.net\/posts\/posts-430033?_escaped_fragment_=\">http:\/\/widjer.net\/posts\/posts-430033?_escaped_fragment_=<\/a>.<br \/>  \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u0442\u044c \u043e\u0431\u0432\u0438\u043d\u0435\u043d\u043d\u044b\u043c \u0432 \u043a\u043b\u043e\u0430\u043a\u0438\u043d\u0433\u0435, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u043f\u043a\u043e\u0432 ajax \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043e \u0447\u0435\u043c \u0438 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041f\u043e\u0438\u0441\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 ASP MVC \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c durandaljs (<a href=\"http:\/\/durandaljs.com\/\">http:\/\/durandaljs.com\/<\/a>). \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 durandal \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (<a href=\"http:\/\/durandaljs.com\/documentation\/Making-Durandal-Apps-SEO-Crawlable.html\">http:\/\/durandaljs.com\/documentation\/Making-Durandal-Apps-SEO-Crawlable.html<\/a>). \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 Blitline (<a href=\"http:\/\/www.blitline.com\/docs\/seo_optimizer\">http:\/\/www.blitline.com\/docs\/seo_optimizer<\/a>). \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u044c\u0441\u044f \u0441 \u0438\u0445 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0435\u0439. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u043f\u043a\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c Amazon S3 bucket. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"http:\/\/aws.amazon.com\/s3\/\">http:\/\/aws.amazon.com\/s3\/<\/a> \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041e\u043f\u0438\u0448\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0448\u0430\u0433\u0438 \u043d\u0435 \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u043a\u0443\u0447\u0430 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u0434\u0430\u043d\u043d\u0443\u044e \u0442\u0435\u043c\u0443. \u0421\u0430\u043c, \u0434\u043e \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u0434\u0435\u043b\u0430 \u0441 \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c \u043d\u0435 \u0438\u043c\u0435\u043b \u0438 \u043d\u0430\u0448\u0435\u043b \u0432\u0441\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<h5>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 S3<\/h5>\n<p>  \u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f S3 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0440\u0438 buckets: day, month, weak. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0435\u0448 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e bucket \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c Lifecycle. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u043e\u0434\u0438\u043d \u0434\u0435\u043d\u044c, 7 \u0434\u043d\u0435\u0439 \u0438 30 \u0434\u043d\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 bucket.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b Blitline \u043c\u043e\u0433 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443 \u043d\u0430\u0441 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e bucket \u0432 \u0438\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438.  <\/p>\n<pre> {      &quot;Version&quot;: &quot;2008-10-17&quot;,      &quot;Statement&quot;: [         {             &quot;Sid&quot;: &quot;AddCannedAcl&quot;,             &quot;Effect&quot;: &quot;Allow&quot;,             &quot;Principal&quot;: { &quot;CanonicalUser&quot;: &quot;dd81f2e5f9fd34f0fca01d29c62e6ae6cafd33079d99d14ad22fbbea41f36d9a&quot;},             &quot;Action&quot;: [                 &quot;s3:PutObjectAcl&quot;,                 &quot;s3:PutObject&quot;             ],             &quot;Resource&quot;: &quot;arn:aws:s3:::YOUR_BUCKET_NAME\/*&quot;         }     ]  } <\/pre>\n<p>  YOUR_BUCKET_NAME \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e bucket.<br \/>  \u0421 S3 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. <\/p>\n<h5>\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c, MVC Controller<\/h5>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 SPA, \u0442\u043e \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0434\u0443\u0442 \u0432 HomeController, \u0430 \u0443\u0436\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u0440\u0430\u0437\u0440\u0443\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f durandal \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041c\u0435\u0442\u043e\u0434 Index \u0432 Home \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.  <\/p>\n<pre> if (Request.QueryString[&quot;_escaped_fragment_&quot;] == null) {             \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430             return View(); }  try  {     \/\/We\u00b4ll crawl the normal url without _escaped_fragment_     var result = await _crawler.SnaphotUrl(                     Request.Url.AbsoluteUri.Replace(&quot;?_escaped_fragment_=&quot;, &quot;&quot;) );     return Content(result); } catch (Exception ex) {     Trace.TraceError(&quot;CrawlError: {0}&quot;, ex.Message);     return View(&quot;FailedCrawl&quot;); } <\/pre>\n<h5>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430<\/h5>\n<p>  _crawler \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/p>\n<pre> public interface ICrawl {         Task&lt;string&gt; SnaphotUrl(string url); } <\/pre>\n<p>  \u041d\u0430 \u0432\u0445\u043e\u0434 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c url, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c html \u043a\u043e\u0434 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/p>\n<pre> public class Crawl: ICrawl     {         private IUrlStorage _sorage; \/\/\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c S3         private ISpaSnapshot _snapshot; \/\/\u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u043d\u0438\u043c\u043a\u043e\u0432         public Crawl(IUrlStorage st, ISpaSnapshot ss)         {             Debug.Assert(st != null);             Debug.Assert(ss != null);             _sorage = st;             _snapshot = ss;         }             public async Task&lt;string&gt; SnaphotUrl(string url)         {             \/\/\u0435\u0441\u0442\u044c \u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0435\u0448\u0435 (S3 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435)             string res = await _sorage.Get(url);             \/\/\u0414\u0430\u043d\u043d\u044b\u0435 \u0435\u0441\u0442\u044c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c             if (!string.IsNullOrWhiteSpace(res))                 return res;             \/\/\u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u0442, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043d\u0438\u043c\u043e\u043a             await _snapshot.TakeSnapshot(url, _sorage);             \/\/\u0442\u0443\u043f\u043e \u0436\u0434\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430             var i = 0;             do {                 res = await _sorage.Get(url);                 if(!string.IsNullOrWhiteSpace(res))                     return res;                 Thread.Sleep(5000);             } while(i &lt; 3);             \/\/\u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c             throw new CrawlException(&quot;\u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043a \u0438 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c&quot;);         }     } <\/pre>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u0435\u043d, \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. <\/p>\n<h5>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 S3<\/h5>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e IUrlStorage  <\/p>\n<pre> public interface IUrlStorage     {         Task&lt;string&gt; Get(string url); \/\/\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043a\u0435\u0448\u0430         Task Put(string url, string body); \/\/\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0435\u0448         \/\/\u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u043e\u043f\u0438\u0448\u0435\u043c         IUrlToBucketNameStrategy BuckName { get; } \/\/\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 url \u0432 bucketname         IUrlToKeyStrategy KeyName { get; } \/\/\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 url \u0432 \u043a\u043b\u044e\u0447 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435     } <\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0441 S3 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f, \u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0435 \u043f\u043e \u043d\u0430\u0438\u0442\u0438\u044e.  <\/p>\n<pre> public class S3Storage: IUrlStorage     {         private IUrlToBucketNameStrategy _buckName; \/\/\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 url \u0432 \u0438\u043c\u044f bucket         public IUrlToBucketNameStrategy BuckName { get { return _buckName;} }                   private IUrlToKeyStrategy _keyName; \/\/\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 url \u0432 \u043a\u043b\u044e\u0447         public IUrlToKeyStrategy KeyName { get { return _keyName; } }         \/\/\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443, \u0431\u0435\u0440\u0435\u043c \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 amazon         private readonly string _amazonS3AccessKeyID;          private readonly string _amazonS3secretAccessKeyID;          private readonly AmazonS3Config _amazonConfig;          public S3Storage(string S3Key = null,              string S3SecretKey = null,              IUrlToBucketNameStrategy bns = null,             IUrlToKeyStrategy kn = null)         {             _amazonS3AccessKeyID = S3Key;             _amazonS3secretAccessKeyID = S3SecretKey;             _buckName = bns ?? new UrlToBucketNameStrategy(); \/\/\u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u0430 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0431\u0435\u0440\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0438\u0436\u0435             _keyName = kn ?? new UrlToKeyStrategy(); \/\/\u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u0430 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0431\u0435\u0440\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0438\u0436\u0435             _amazonConfig = new AmazonS3Config              {                 RegionEndpoint = Amazon.RegionEndpoint.USEast1 \/\/\u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 bucket \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043e US Default, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435             };         }          public async Task&lt;string&gt; Get(string url)         {             \/\/\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c url \u0432 \u0438\u043c\u044f bucket \u0438 \u043a\u043b\u044e\u0447             string bucket = _buckName.Get(url),                  key = _keyName.Get(url),                 res = string.Empty;             \/\/\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430             var client = CreateClient();             \/\/\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441             GetObjectRequest request = new GetObjectRequest             {                 BucketName = bucket,                 Key = key,             };              try             {                 \/\/\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430                 var S3response = await client.GetObjectAsync(request);                 using (var reader = new StreamReader(S3response.ResponseStream))                 {                     res = reader.ReadToEnd();                 }             }             catch (AmazonS3Exception ex)             {                 if (ex.ErrorCode != &quot;NoSuchKey&quot;)                     throw ex;             }              return res;         }          private IAmazonS3 CreateClient()         {             \/\/\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430             var client = string.IsNullOrWhiteSpace(_amazonS3AccessKeyID) \/\/\u0431\u044b\u043b\u0438 \u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u043b\u044e\u0447\u0438 \u0432 \u043a\u043e\u0434\u0435 \u0438\u043b\u0438 \u0438\u0445 \u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a                 ? Amazon.AWSClientFactory.CreateAmazonS3Client(_amazonConfig) \/\/from appSettings                 : Amazon.AWSClientFactory.CreateAmazonS3Client(_amazonS3AccessKeyID, _amazonS3secretAccessKeyID, _amazonConfig);             return client;         }          public async Task Put(string url, string body)         {             string bucket = _buckName.Get(url),                 key = _keyName.Get(url);              var client = CreateClient();              PutObjectRequest request = new PutObjectRequest             {                 BucketName = bucket,                 Key = key,                 ContentType = &quot;text\/html&quot;,                 ContentBody = body             };              await client.PutObjectAsync(request);         }     } <\/pre>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043c\u044b \u0443\u043c\u0435\u0435\u043c, \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 url \u0432 \u0430\u0434\u0440\u0435\u0441 \u0432 S3 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435. Bucket \u0443 \u043d\u0430\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u0435\u0448\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u0432\u043e\u0442 \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u043e\u044f.  <\/p>\n<pre> public interface IUrlToBucketNameStrategy     {         string Get(string url); \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c url, \u043e\u0442\u0434\u0430\u0435\u043c \u0438\u043c\u044f \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e bucket     }  public class UrlToBucketNameStrategy : IUrlToBucketNameStrategy     {         private static readonly char[] Sep = new[] { '\/' };         public string Get(string url)         {             Debug.Assert(url != null);              var bucketName = &quot;day&quot;; \/\/\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0445\u0440\u0430\u043d\u0438\u043c \u0434\u0435\u043d\u044c             var parts = url.Split(Sep, StringSplitOptions.RemoveEmptyEntries);              if(parts.Length &gt; 1)             {                 \/\/\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b                 switch(parts[1])                 {                     case &quot;posts&quot;: \/\/\u044d\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u043e\u0441\u0442\u0430, \u043e\u043d\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043b\u0433\u043e, \u043a\u043b\u0430\u0434\u0435\u043c \u043d\u0430 \u043c\u0435\u0441\u044f\u0446                         bucketName = &quot;month&quot;;                         break;                     case &quot;users&quot;: \/\/\u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0438\u0446\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0445\u0440\u0430\u043d\u0438\u043c \u043d\u0435\u0434\u0435\u043b\u044e                         bucketName = &quot;weak&quot;;                         break;                 }             }             return bucketName;         }     } <\/pre>\n<p>  \u0418\u043c\u044f bucket \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0417\u0430 \u044d\u0442\u043e \u0443 \u043d\u0430\u0441 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 IUrlToKeyStrategy.  <\/p>\n<pre> public interface IUrlToKeyStrategy     {         string Get(string url);     }  public class UrlToKeyStrategy: IUrlToKeyStrategy     {         private static readonly char[] Sep = new[] { '\/' };         public string Get(string url)         {             Debug.Assert(url != null);              string key = &quot;mainpage&quot;;             \/\/\u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0447\u0430\u0441\u0442\u0438             var parts = url.Split(Sep, StringSplitOptions.RemoveEmptyEntries);             \/\/\u0435\u0441\u043b\u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c             if(parts.Length &gt; 0)             {                    \/\/\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0447\u043a\u0438 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432 &quot;\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439&quot; \u0432\u0438\u0434                 key = string.Join(&quot;.&quot;, parts.Select(x =&gt; HttpUtility.UrlEncode(x)));             }              return key;         }     } <\/pre>\n<p>  \u0421 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u041c\u0430\u0440\u043b\u0435\u0437\u043e\u043d\u0441\u043a\u043e\u0433\u043e \u0431\u0430\u043b\u0435\u0442\u0430.<\/p>\n<h5>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043f\u0438\u0439 AJAX \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/h5>\n<p>  \u0417\u0430 \u044d\u0442\u043e \u0443 \u043d\u0430\u0441 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 ISpaSnapshot  <\/p>\n<pre> public interface ISpaSnapshot     {         Task TakeSnapshot(string url, IUrlStorage storage);     } <\/pre>\n<p>  \u0412\u043e\u0442 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0430\u044f \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c Blitline. \u041a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b, \u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043d\u0430 \u0438\u0445 \u0441\u0430\u0439\u0442\u0435.  <\/p>\n<pre> public class BlitlineSpaSnapshot : ISpaSnapshot     {         private string _appId; \/\/id \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043d\u0430\u043c \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438         private IUrlStorage _storage; \/\/\u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441         private int _regTimeout = 30000; \/\/30s \/\/\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0436\u0434\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c          public BlitlineSpaSnapshot(string appId, IUrlStorage st)         {             _appId = appId;             _storage = st;         }          public async Task TakeSnapshot(string url, IUrlStorage storage)         {             \/\/\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0443             string jsonData = FormatCrawlRequest(url);             \/\/\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441              var resp = await Crawl(url, jsonData);             \/\/\u0432 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435             if (!string.IsNullOrWhiteSpace(resp))                 throw new CrawlException(resp);         }          private async Task&lt;string&gt; Crawl(string url, string jsonData)         {             \/\/\u0442\u0443\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430             string crawlResponse = string.Empty;              using (var client = new HttpClient())             {                 var result = await client.PostAsync(&quot;http:\/\/api.blitline.com\/job&quot;,                      new FormUrlEncodedContent(new Dictionary&lt;string, string&gt; { { &quot;json&quot;, jsonData } }));                                  var o = result.Content.ReadAsStringAsync().Result;                 \/\/\u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435                 var response = JsonConvert.DeserializeObject&lt;BlitlineBatchResponse&gt;(o);                 \/\/\u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438                 if(response.Failed)                     crawlResponse = string.Join(&quot;; &quot;, response.Results.Select(x =&gt; x.Error));             }              return crawlResponse;         }          private string FormatCrawlRequest(string url)         {             \/\/\u0437\u0434\u0435\u0441\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u043e\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0432 JSON             var reqData = new BlitlineRequest             {                 ApplicationId = _appId,                 Src = url,                 SrcType = &quot;screen_shot_url&quot;,                 SrcData = new SrcDataDto                 {                     ViewPort = &quot;1200x800&quot;,                     SaveHtml = new SaveDest                     {                         S3Des = new StorageDestination                         {                             Bucket = _storage.BuckName.Get(url),                             Key = _storage.KeyName.Get(url)                         }                     }                 },                 Functions = new[] {                      new FunctionData { Name = &quot;no_op&quot; }                 }             };              return JsonConvert.SerializeObject(new[] { reqData });         }     } <\/pre>\n<h4>\u0414\u0435\u043b\u0430\u0435\u043c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434<\/h4>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441\u0430\u0439\u0442\u0430 \u0431\u044b\u043b\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u0435\u043b\u0438\u043a\u043e, \u0430 \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0437\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u0412\u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043d\u0438\u043c\u043a\u043e\u0432 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f <a href=\"http:\/\/phantomjs.org\/\">PhantomJS<\/a><\/p>\n<pre> public class PhantomJsSnapShot : ISpaSnapshot     {         private readonly string _exePath; \/\/\u043f\u0443\u0442\u044c \u043a PhantomJS         private readonly string _jsPath; \/\/\u043f\u0443\u0442\u044c \u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0443, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435          public PhantomJsSnapShot(string exePath, string jsPath)         {             _exePath = exePath;             _jsPath = jsPath;         }          public Task TakeSnapshot(string url, IUrlStorage storage)         {            \/\/\u0441\u0442\u0430\u0440\u0442\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043d\u0438\u043a\u0430             var startInfo = new ProcessStartInfo {                 Arguments = String.Format(&quot;{0} {1}&quot;, _jsPath, url),                 FileName = _exePath,                 UseShellExecute = false,                 CreateNoWindow = true,                 RedirectStandardOutput = true,                 RedirectStandardError = true,                 RedirectStandardInput = true,                 StandardOutputEncoding = System.Text.Encoding.UTF8             };              Process p = new Process { StartInfo = startInfo };             p.Start();             \/\/\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435             string output = p.StandardOutput.ReadToEnd();             p.WaitForExit();             \/\/\u043a\u043b\u0430\u0434\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435             return storage.Put(url, output);         }     } <\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043d\u0438\u043c\u043a\u0430 _jsPath  <\/p>\n<pre> var resourceWait = 13000,     maxRenderWait = 13000;  var page = require('webpage').create(),     system = require('system'),     count = 0,     forcedRenderTimeout,     renderTimeout;  page.viewportSize = { width: 1280, height: 1024 };  function doRender() {     console.log(page.content);     phantom.exit(); }  page.onResourceRequested = function (req) {     count += 1;     clearTimeout(renderTimeout); };  page.onResourceReceived = function (res) {     if (!res.stage || res.stage === 'end') {         count -= 1;         if (count === 0) {             renderTimeout = setTimeout(doRender, resourceWait);         }     } };  page.open(system.args[1], function (status) {     if (status !== &quot;success&quot;) {         phantom.exit();     } else {         forcedRenderTimeout = setTimeout(function () {             doRender();         }, maxRenderWait);     } }); <\/pre>\n<p>  <\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 AJAX \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0441\u043a\u043e\u0440\u0443\u044e \u0440\u0443\u043a\u0443 \u0438 \u0432 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u0435\u0445\u0438. \u0414\u0435\u043c\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/widjer.net\">widjer.net<\/a> (\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e DEMO). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 url <a href=\"http:\/\/widjer.net\/timeline\/%23\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435_\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\">http:\/\/widjer.net\/timeline\/%23\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435_\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438<\/a>. \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <a href=\"http:\/\/widjer.net\/timeline\/%23\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435_\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438?_escaped_fragment_=\">http:\/\/widjer.net\/timeline\/%23\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435_\u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438?_escaped_fragment_=<\/a> \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c javascript. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u043e\u0439 \u043e\u043f\u044b\u0442.    \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\/219875\/\"> http:\/\/habrahabr.ru\/post\/219875\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0435\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u0435 AJAX \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c, \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u0430\u043c\u0438. \u0423 \u042f\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 Google \u0435\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 (<a href=\"https:\/\/developers.google.com\/webmasters\/ajax-crawling\/\">https:\/\/developers.google.com\/webmasters\/ajax-crawling\/<\/a> <a href=\"http:\/\/help.yandex.ru\/webmaster\/robot-workings\/ajax-indexing.xml\">http:\/\/help.yandex.ru\/webmaster\/robot-workings\/ajax-indexing.xml<\/a>). \u0421\u0443\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0443 \u043e HTML \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0432 \u0442\u0435\u043b\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0435\u0433 <code>&lt;meta name=&quot;fragment&quot; content=&quot;!&quot;&gt;<\/code>. \u042d\u0442\u043e\u0442 \u0442\u0435\u0433 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 AJAX \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445. HTML \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/www.example.com\/\u0447\u0442\u043e\u0442\u043e\u0435\u0449\u0435?_escaped_fragment_=\">www.example.com\/\u0447\u0442\u043e\u0442\u043e\u0435\u0449\u0435?_escaped_fragment_=<\/a>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 <a href=\"http:\/\/widjer.net\/posts\/posts-430033\">http:\/\/widjer.net\/posts\/posts-430033<\/a>, \u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0430\u0434\u0440\u0435\u0441 <a href=\"http:\/\/widjer.net\/posts\/posts-430033?_escaped_fragment_=\">http:\/\/widjer.net\/posts\/posts-430033?_escaped_fragment_=<\/a>.<br \/>  \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u0442\u044c \u043e\u0431\u0432\u0438\u043d\u0435\u043d\u043d\u044b\u043c \u0432 \u043a\u043b\u043e\u0430\u043a\u0438\u043d\u0433\u0435, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u043f\u043a\u043e\u0432 ajax \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043e \u0447\u0435\u043c \u0438 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c.  <\/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-219875","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/219875","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=219875"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/219875\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=219875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=219875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=219875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}