{"id":173509,"date":"2013-03-20T01:16:04","date_gmt":"2013-03-19T21:16:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=173509"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=173509","title":{"rendered":"<span class=\"post_title\">Grab \u2014 \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 DOM-\u0434\u0435\u0440\u0435\u0432\u043e\u043c HTML-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441<\/h2>\n<p>  \u0420\u0430\u043d\u0435\u0435 \u044f \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043e <a href=\"http:\/\/grablib.org\">Grab<\/a> \u2014 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u0432 \u0441\u0430\u0439\u0442\u043e\u0432: <a href=\"http:\/\/habrahabr.ru\/post\/127584\/\">\u0440\u0430\u0437<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/134918\/\">\u0434\u0432\u0430<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/139435\/\">\u0442\u0440\u0438<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/142288\/\">\u0447\u0435\u0442\u044b\u0440\u0435<\/a>. \u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445, Grab \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u043f\u043e\u0432\u0435\u0440\u0445 \u0434\u0432\u0443\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a: pycurl \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e \u0438 lxml \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 HTML-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<a name=\"habracut\"><\/a><\/p>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 lxml \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c XPATH-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a DOM-\u0434\u0435\u0440\u0435\u0432\u0443 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0432\u0438\u0434\u0435 ElementTree \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043a\u0443\u0447\u0443 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c xpath-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 \u0433\u0440\u0430\u0431. \u041f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from grab import Grab &gt;&gt;&gt; g = Grab() &gt;&gt;&gt; g.go('http:\/\/habrahabr.ru\/') &lt;grab.response.Response object at 0x7fe5f7189850&gt; &gt;&gt;&gt; print g.xpath_text('\/\/title') \u041b\u0443\u0447\u0448\u0438\u0435 \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \/ \u041f\u043e\u0441\u0442\u044b \/ \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440 <\/code><\/pre>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043a\u043e\u0434\u0443:<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from urllib import urlopen &gt;&gt;&gt; from lxml.html import fromstring &gt;&gt;&gt; data = urlopen('http:\/\/habrahabr.ru\/').read() &gt;&gt;&gt; dom = fromstring(data) &gt;&gt;&gt; print dom.xpath('\/\/title')[0].text_content() \u041b\u0443\u0447\u0448\u0438\u0435 \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \/ \u041f\u043e\u0441\u0442\u044b \/ \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440 <\/code><\/pre>\n<p>  \u0423\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u0430 xpath_text \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 Grab \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e, \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043c\u0435\u0442\u043e\u0434 xpath_text \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0442\u0430\u043a\u0436\u0435 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u0432\u0441\u0435\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u0430\u043b\u0435\u0435 \u044f \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Grab \u0441 \u0438\u0445 \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c:<\/p>\n<ul>\n<li>grab.xpath \u2014 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0449\u0438\u0439 \u0443\u0441\u043b\u043e\u0432\u0438\u044e<\/li>\n<li>grab.xpath_list \u2014 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b<\/li>\n<li>grab.xpath_text \u2014 \u0432\u0437\u044f\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0439 \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0442\u044c default \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435, \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d<\/li>\n<li>grab.xpath_number \u2014 \u0432\u0437\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 grab.xpath_text \u0438 \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0451\u043c \u0447\u0438\u0441\u043b\u043e<\/li>\n<\/ul>\n<p>  \u041d\u0435 \u043e\u0431\u043e\u0448\u043b\u043e\u0441\u044c \u0438 \u0431\u0435\u0437 \u043a\u043e\u043d\u0444\u0443\u0437\u043e\u0432. \u041c\u0435\u0442\u043e\u0434 grab.xpath \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043c\u0435\u0442\u043e\u0434 xpath ElementTree \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a. \u041d\u0430\u0440\u043e\u0434 \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043d\u0430\u0442\u044b\u043a\u0430\u043b\u0441\u044f \u043d\u0430 \u044d\u0442\u0443 \u0433\u0440\u0430\u0431\u043b\u044e. \u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0447\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u044b\u043b \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 css \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0442.\u0435. grab.css, grab.css_list, grab.css_text \u0438 \u0442.\u0434., \u043d\u043e \u044f \u043b\u0438\u0447\u043d\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0442 CSS-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 XPATH \u0442.\u043a. XPATH \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0438 \u0447\u0430\u0441\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u044f \u043d\u0435 \u0445\u043e\u0442\u0435\u043b \u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u043a\u043e\u0434\u0435 \u043c\u0435\u0448\u0430\u043d\u0438\u043d\u0443 \u0438\u0437 CSS \u0438 XPATH \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0423 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0431\u044b\u043b \u0440\u044f\u0434 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432:<\/p>\n<p>  \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043a\u043e\u0434 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b \u0441\u043e\u0431\u043b\u0430\u0437\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0451 \u0432\u0435\u0441\u044c Grab \u043e\u0431\u044a\u0435\u043a\u0442, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0442 \u043d\u0435\u0433\u043e \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043d\u0438\u043a\u0430\u043a: \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c Grab \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0433\u043e\u043b\u044b\u0439 DOM-\u043e\u0431\u044a\u0435\u043a\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0442\u0438\u043f\u0430 xpath_text.<\/p>\n<p>  \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 grab.xpath \u0438 grab.xpath_list \u2014 \u044d\u0442\u043e \u0433\u043e\u043b\u044b\u0435 ElementTree \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0436\u0435 \u043d\u0435\u0442\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u0438\u043f\u0430 xpath_text.<\/p>\n<p>  \u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u043d\u043e, \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435, \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0438\u043c\u0451\u043d \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Grab \u0437\u0430\u0441\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  \u0410, \u0434\u0430, \u0438 \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u043e\u0435. \u041c\u0435\u043d\u044f \u0437\u0430\u043a\u043e\u043b\u0435\u0431\u0430\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c HTML \u043a\u043e\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 grab.xpath \u0438 grab.xpath_list. \u041d\u0430\u0440\u043e\u0434 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e grab \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 lxml \u0438 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u0430\u043d\u0443\u0430\u043b \u043d\u0430 <a href=\"http:\/\/lxml.de\">lxml.de<\/a><\/p>\n<p>  \u041d\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 DOM-\u0434\u0435\u0440\u0435\u0432\u043e\u043c \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c Scrapy, \u0442\u043e \u043d\u0438\u0436\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0430\u043c \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b. \u042f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430\u0445.<\/p>\n<h2>\u0421\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b<\/h2>\n<p>  \u0421\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b, \u0447\u0442\u043e \u044d\u0442\u043e? \u042d\u0442\u043e \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 ElementTree \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0432 \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0451 DOM \u0434\u0435\u0440\u0435\u0432\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0442.\u0435. \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e html \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 select \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 XPATH \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u044f\u0442\u044c \u0437\u0430\u0432\u0451\u0440\u043d\u0443\u0442 \u0432 Selector \u043e\u0431\u0451\u0440\u0442\u043a\u0443.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from grab.selector import Selector &gt;&gt;&gt; from lxml.html import fromstring &gt;&gt;&gt; root = Selector(fromstring('&lt;html&gt;&lt;body&gt;&lt;h1&gt;Header&lt;\/h1&gt;&lt;ul&gt;&lt;li&gt;Item 1&lt;\/li&gt;&lt;li&gt;&lt;li&gt;item 2&lt;\/li&gt;&lt;\/ul&gt;&lt;span id=&quot;color&quot;&gt;green&lt;\/span&gt;')) <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u043c select, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u043e\u0432\u044b\u0445 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0443 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 one() \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a ElementTree \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443 node \u0443 \u043b\u044e\u0431\u043e\u0433\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; root.select('\/\/ul') &lt;grab.selector.selector.SelectorList object at 0x7fe5f41922d0&gt; &gt;&gt;&gt; root.select('\/\/ul')[0] &lt;grab.selector.selector.Selector object at 0x7fe5f419bed0&gt; &gt;&gt;&gt; root.select('\/\/ul')[0].node &lt;Element ul at 0x7fe5f41a7a70&gt; &gt;&gt;&gt; root.select('\/\/ul').one() &lt;grab.selector.selector.Selector object at 0x7fe5f419bed0&gt; <\/code><\/pre>\n<p>  \u041a\u0430\u043a\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430\u0434 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; root.select('\/\/ul\/li')[0].text() 'Item 1' &gt;&gt;&gt; root.select('\/\/ul\/li')[0].number() 1 &gt;&gt;&gt; root.select('\/\/ul\/li\/text()')[0].rex('(\\w+)').text() 'Item' <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0443. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c, \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0438\u043d\u0434\u0435\u043a\u0441, \u0442\u043e\u0433\u0434\u0430, \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; root.select('\/\/ul\/li').text() 'Item 1' &gt;&gt;&gt; root.select('\/\/ul\/li').number() 1 &gt;&gt;&gt; root.select('\/\/ul\/li\/text()').rex('em (\\d+)').text() '1' &gt;&gt;&gt; root.select('\/\/ul\/li\/text()').rex('em (\\d+)').number() 1 <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0435\u0449\u0451? \u041c\u0435\u0442\u043e\u0434 html \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f HTML-\u043a\u043e\u0434\u0430 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430, \u043c\u0435\u0442\u043e\u0434 exists \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0441\u0435\u043b\u0435\u043a\u0442 \u0443 \u043b\u044e\u0431\u043e\u0433\u043e \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; root.select('\/\/span')[0].html() u'&lt;span id=&quot;color&quot;&gt;green&lt;\/span&gt;' &gt;&gt;&gt; root.select('\/\/span').exists() True &gt;&gt;&gt; root.select('\/\/god').exists() False &gt;&gt;&gt; root.select('\/\/ul')[0].select('.\/li[3]').text() 'item 2' <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437 Grab \u043e\u0431\u044a\u0435\u043a\u0442\u0430? C \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 doc \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c\u0443 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0443 DOM-\u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0434\u0430\u043b\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 select \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438:<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from grab import Grab &gt;&gt;&gt; g = Grab() &gt;&gt;&gt; g.go('http:\/\/habrahabr.ru\/') &lt;grab.response.Response object at 0x2853410&gt; &gt;&gt;&gt; print g.doc.select('\/\/h1').text() \u0421\u043a\u0430\u0437 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u043d\u0435\u0440\u0430\u0434\u0438\u0432\u044b\u0439 \u043f\u0440\u043e\u0432\u0438\u043d\u0446\u0438\u0430\u043b \u0432 MIT \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u043b \u0438\u0437 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u044b &gt;&gt;&gt; print g.doc.select('\/\/div[contains(@class, &quot;post&quot;)][2]')[0].select('.\/\/div[@class=&quot;favs_count&quot;]').number() 60 &gt;&gt;&gt; print g.doc.select('\/\/div[contains(@class, &quot;post&quot;)][2]')[0].select('.\/\/div[@class=&quot;favs_count&quot;]')[0].html() &lt;div class=&quot;favs_count&quot; title=&quot;\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0434\u043e\u0431\u0430\u0432\u0438\u0432\u0448\u0438\u0445 \u043f\u043e\u0441\u0442 \u0432 \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u043e\u0435&quot;&gt;60&lt;\/div&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0432 Grab \u0435\u0449\u0451 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u044b\u0440\u0430\u044f, \u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0438 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u044f \u0434\u0443\u043c\u0430\u044e \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e.<\/p>\n<p>  \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 Grab, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 pypi \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438, \u0441\u0442\u0430\u0432\u044c\u0442\u0435 Grab \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f: <a href=\"https:\/\/bitbucket.org\/lorien\/grab\">bitbucket.org\/lorien\/grab<\/a>. \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/bitbucket.org\/lorien\/grab\/src\/tip\/grab\/selector\/selector.py?at=default\">\u0442\u0443\u0442<\/a><\/p>\n<p>  \u042f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e datalab.io \u2014 \u043c\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u043e\u043c \u0441\u0430\u0439\u0442\u043e\u0432, \u043f\u0430\u0440\u0441\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Grab \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Grab, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0430\u043c \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Grab \u043f\u043e\u0434 \u0432\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b.    \t \t\t \t\t\t \t<\/p>\n<div class=\"polling\">\n<form action=\"\/json\/polling\/\" class=\"poll\" method=\"post\">\n<div class=\"poll_title\">\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0441\u0430\u0439\u0442\u043e\u0432<\/div>\n<p>  \t\t<input type=\"hidden\" name=\"post_id\" value=\"173509\"\/> \t\t<input type=\"hidden\" name=\"polling_question_id\" value=\"7583\"\/>  \t\t<\/p>\n<table class=\"answer\">\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv39547\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"39547\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv39547\">Grab \u0438\u043b\u0438 Grab::Spider<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv39549\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"39549\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv39549\">\u0413\u043e\u043b\u044b\u0439 pycurl<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv39551\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"39551\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv39551\">Scrapy<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv39553\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"39553\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv39553\">urllib\/urllib2<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv39555\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"39555\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv39555\">Requests<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv39557\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"39557\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv39557\">urllib\/urllib2 + gevent<\/label> \t\t\t\t<\/td>\n<\/tr>\n<tr>\n<td class=\"input\"> \t\t\t\t\t<input type=\"checkbox\" id=\"vv39559\" \t\t\t\t\t\tclass=\"checkbox js-field-data\" \t\t\t\t\t\tname=\"variant[]\" \t\t\t\t\t\tvalue=\"39559\" \/> \t\t\t\t<\/td>\n<td class=\"label\"> \t\t\t\t\t<label for=\"vv39559\">\u0414\u0440\u0443\u0433\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/label> \t\t\t\t<\/td>\n<\/tr>\n<\/table>\n<p class=\"for_users_only_msg\">\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a href=\"\/login\/\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/p>\n<p class=\"total\">\u041d\u0438\u043a\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b. \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0435\u0442.<\/p>\n<\/p><\/form>\n<\/p><\/div>\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\/173509\/\"> http:\/\/habrahabr.ru\/post\/173509\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441<\/h2>\n<p>  \u0420\u0430\u043d\u0435\u0435 \u044f \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043e <a href=\"http:\/\/grablib.org\">Grab<\/a> \u2014 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u0432 \u0441\u0430\u0439\u0442\u043e\u0432: <a href=\"http:\/\/habrahabr.ru\/post\/127584\/\">\u0440\u0430\u0437<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/134918\/\">\u0434\u0432\u0430<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/139435\/\">\u0442\u0440\u0438<\/a>, <a href=\"http:\/\/habrahabr.ru\/post\/142288\/\">\u0447\u0435\u0442\u044b\u0440\u0435<\/a>. \u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445, Grab \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u043f\u043e\u0432\u0435\u0440\u0445 \u0434\u0432\u0443\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a: pycurl \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e \u0438 lxml \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 HTML-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/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-173509","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/173509","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=173509"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/173509\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}