{"id":336679,"date":"2022-08-07T03:00:09","date_gmt":"2022-08-07T03:00:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336679"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336679","title":{"rendered":"<span>\u041f\u043e\u0438\u0441\u043a \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e API \u0441\u0430\u0439\u0442\u0430 \u0438\u043b\u0438 \u0423\u0441\u043a\u043e\u0440\u044f\u0435\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0432 10 \u0440\u0430\u0437<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h1 id=\"poisk-otkrytogo-api-sayta-ili-uskoryaem-parsing-v-10-raz\">\u041f\u043e\u0438\u0441\u043a \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e API \u0441\u0430\u0439\u0442\u0430 \u0438\u043b\u0438 \u0423\u0441\u043a\u043e\u0440\u044f\u0435\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0432 10 \u0440\u0430\u0437<\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1a\/yi\/3j\/1ayi3jluxwebiankees5suyqhwu.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/1a\/yi\/3j\/1ayi3jluxwebiankees5suyqhwu.png\"\/><\/p>\n<p>  <\/p>\n<p><strong>\u0426\u0435\u043b\u044c \u0441\u0442\u0430\u0442\u044c\u0438<\/strong> \u2014 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e API \u0441\u0430\u0439\u0442\u0430.<br \/>  <strong>\u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438<\/strong> \u2014 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441\u0430\u0439\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a\u0430 API \u0441\u0430\u0439\u0442\u0430 edadeal.ru, \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c google protobuf \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"1-vvedenie\">1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 (\u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u0442\u0430\u0442\u044c\u0438) \u2014 \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 2 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441\u0430\u0439\u0442\u0430<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 HTML-\u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0430\u0439\u0442\u0430<br \/>  <strong>\u041f\u043b\u044e\u0441\u044b <\/strong> \u2014 \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0441\u0442 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e<br \/>  <strong>\u041c\u0438\u043d\u0443\u0441\u044b <\/strong> \u2014 \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e\u043b\u0433\u043e (\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434), \u0435\u0441\u043b\u0438 \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 java script (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438)<\/p>\n<p>  <\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API \u0441\u0430\u0439\u0442\u0430<br \/>  <strong>\u041f\u043b\u044e\u0441\u044b <\/strong> \u2014 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b html-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<br \/>  <strong>\u041c\u0438\u043d\u0443\u0441 <\/strong> \u2014 \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 API<\/p>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a\u0430 API \u0441\u0430\u0439\u0442\u0430 edadeal.ru, \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c google protobuf \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u0432\u0443\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 <\/p>\n<p>  <\/p>\n<h3 id=\"2-postanovka-zadachi\">2. \u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u2014 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u0445 \u0441 \u0441\u0430\u0439\u0442\u0430 \u0415\u0434\u0430\u0434\u0438\u043b (\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430, \u0446\u0435\u043d\u0430, \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043a\u0438\u0434\u043a\u0438, \u043c\u0430\u0433\u0430\u0437\u0438\u043d, \u0433\u043e\u0440\u043e\u0434 \u0438 \u0442.\u0434)<\/p>\n<p>  <\/p>\n<h3 id=\"3-reshenie\">3. \u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<p>1 \u0414\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0430\u0440\u0441\u0438\u0442\u044c.<br \/>  2 \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u0439\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c DevTools \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/cz\/rw\/sn\/czrwsnofw2uhyrochyx_8a5vj14.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/cz\/rw\/sn\/czrwsnofw2uhyrochyx_8a5vj14.png\"\/><\/p>\n<p>  <\/p>\n<p>3 \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b<br \/>  \u0418\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0437\u0430\u043f\u0440\u043e\u0441<br \/>  <code>https:\/\/squark.edadeal.ru\/web\/search\/offers?count=30&amp;locality=moskva&amp;page=1&amp;retailer=5ka<\/code><\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b (\u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e binary_file.bin). \u041a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430?<br \/>  \u0424\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u043f\u0443\u043d\u043a\u0442\u0430 3 \u043d\u0430\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0430-\u0445\u0435\u0434\u0435\u0440 <code>content-type: application\/x-protobuf<\/code><\/p>\n<p>  <\/p>\n<p>4 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (.proto \u0444\u0430\u0439\u043b)<br \/>  \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b protoc (<a href=\"http:\/\/google.github.io\/proto-lens\/installing-protoc.html\" rel=\"nofollow noopener noreferrer\">http:\/\/google.github.io\/proto-lens\/installing-protoc.html<\/a>) \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0444\u043e\u0440\u043c\u0430\u0442<br \/>  <code>protoc --decode_raw &lt; binary_file.bin<\/code><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">1 {   1: \"e\\341_\\260\\007\\177W\\202\\222O\\326\\316\\233\\326\\000A\"   2: \"\\320\\242\\321\\203\\320\\260\\320\\273\\320\\265\\321\\202\\320\\275\\320\\260\\321\\217 \\320\\261\\321\\203\\320\\274\\320\\260\\320\\263\\320\\260 Familia Plus, 2 \\321\\201\\320\\273\\320\\276\\321\\217, 12 \\321\\200\\321\\203\\320\\273\\320\\276\\320\\275\\320\\276\\320\\262, 1 \\321\\203\\320\\277.\"   3: \"https:\/\/leonardo.edadeal.io\/dyn\/cr\/catalyst\/offers\/u4nf6zbkjc3m5lss46ucvxjafm.jpg\"   4: 0x43ad7eb8   5: 0x4347e666   7: \";5\\332^c\\021\\021\\346\\204\\237RT\\000\\020\\266\\010\"   8: 0x41400000   9: \"\\321\\210\\321\\202\"   10: 0x422c0000   11: \"%\"   13: 43   15: \"2022-07-26T00:00:00Z\"   16: \"2022-08-01T00:00:00Z\"   19: \"A1\\005L\\332nPg\\230\\342q\\375\\031\\335\\014\\336\"   20 {     1: 0x3f800000     2: 0x418547ae     3: \"\\321\\210\\321\\202\"     4: 1   }   21: \"\\224\\331\\203\\202B\\303\\021\\346\\224\\031RT\\000\\020\\266\\010\"   22: \"K3\\020\\2537{O\\271\\273\\374K\\351\\376\\224\\310*\"   22: \"\\300\\336d(\\224kL\\025\\224\\300\\355\\256\\247\\327R\\035\"   22: \"\\303O:\\202\\330\\262A\\326\\246\\023\\307D\\314F\\303G\"   22: \"\\210\\\"\\022?\\250|L.\\272\\375\\345{\\335c,\\026\"   22: \"=3yP\\026\\004N\\334\\267\\377\\320\\036F\\326\\331\\\\\"   22: \"E\\211\\000\\246e6EI\\223\\000)\\242\\3348\\216M\"   22: \"V#\\263\\022\\367\\324H\\350\\232r\\013\\010_KX\\273\"   23: \"\\320\\232\\320\\276\\320\\273\\320\\270\\321\\207\\320\\265\\321\\201\\321\\202\\320\\262\\320\\276\"   24: 1 }<\/code><\/pre>\n<p>  <\/p>\n<p>5 \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c .proto \u0444\u0430\u0439\u043b<br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u043e\u043c\u0435\u0440\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430, \u043f\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 3 \u2014 \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430)<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0431 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">syntax = \"proto2\";  message Offers {   repeated Offer offer = 1; }  message Offer {   optional string name = 2;   optional string image_url = 3;   optional float price_before = 4;   optional float price_after = 5;   optional float amount = 8;   optional float discount = 10;   optional string start_date = 15;   optional string end_date = 16; } <\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"4-perehodim-k-napisaniyu-koda\">4 \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430<\/h3>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u0444\u0430\u0439\u043b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u0437 .proto \u0444\u0430\u0439\u043b\u0430<br \/>  <code>protoc --proto_path=proto_files --python_out=proto_structs offers.proto<\/code><\/p>\n<p>  <\/p>\n<p><code>proto_files<\/code> \u2014 \u0438\u043c\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 .proto \u0444\u0430\u0439\u043b\u0430\u043c\u0438<br \/>  <code>proto_structs<\/code> \u2014 \u0432 \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b (_pb2.py \u0444\u0430\u0439\u043b\u044b)<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0414\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a API \u0441\u0430\u0439\u0442\u0430<\/li>\n<li>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441\u0430\u0439\u0442\u0430 \u0432 json <\/li>\n<li>\u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/li>\n<\/ol>\n<p>  <\/p>\n<pre><code class=\"plaintext\">import json import requests  from google.protobuf.json_format import MessageToJson from proto_structs import offers_pb2  def parse_page(city = \"moskva\", shop = \"5ka\", page_num = 1):     \"\"\"     :param city: location of the shop     :param shop: shop name     :param page_num: parsed page number     :return: None     \"\"\"     url = f\"https:\/\/squark.edadeal.ru\/web\/search\/offers?count=30&amp;locality={city}&amp;page={page_num}&amp;retailer={shop}\"     data = requests.get(url, allow_redirects=True)  # data.content is a protobuf message      offers = offers_pb2.Offers()  # protobuf structure     offers.ParseFromString(data.content)  # parse binary data     products: str = MessageToJson(offers)  # convert protobuf message to json     products = json.loads(products)     print(json.dumps(products, indent=4, ensure_ascii=False,))  if __name__ == \"__main__\":     parse_page() <\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     \"offer\": [         {             \"name\": \"\u041d\u0430\u0433\u0433\u0435\u0442\u0441\u044b, \u043a\u0443\u0440\u0438\u043d\u044b\u0435 \u0441 \u0432\u0435\u0442\u0447\u0438\u043d\u043e\u0439, \u041c\u0438\u0440\u0430\u0442\u043e\u0440\u0433, 300 \u0433\",             \"imageUrl\": \"https:\/\/leonardo.edadeal.io\/dyn\/cr\/catalyst\/offers\/necnmkv43splbm3hr5636snpry.jpg\",             \"priceBefore\": 218.99000549316406,             \"priceAfter\": 109.48999786376953,             \"amount\": 300.0,             \"discount\": 51.0,             \"startDate\": \"2022-08-02T00:00:00Z\",             \"endDate\": \"2022-08-08T00:00:00Z\"         },         ...<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"5-sravnim-rezultaty\">5 \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h3>\n<p>  <\/p>\n<p>\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 0.3 \u2014 0.4 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<br \/>  \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u2014 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0441\u0435\u0433\u043e html-\u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">from selenium import webdriver  driver = webdriver.Chrome() driver.get(\"https:\/\/edadeal.ru\/moskva\/retailers\/5ka\") # \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 html \u043a\u043e\u0434\u0430<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b 5 \u2014 6 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>  <\/p>\n<h3 id=\"6-vyvody\">6 \u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>  <\/p>\n<p>\u041b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API \u0441\u0430\u0439\u0442\u0430 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c<br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 API \u0441\u0430\u0439\u0442\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0439 \u0432 html-\u043a\u043e\u0434\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u044b<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/680320\/\"> https:\/\/habr.com\/ru\/post\/680320\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h1 id=\"poisk-otkrytogo-api-sayta-ili-uskoryaem-parsing-v-10-raz\">\u041f\u043e\u0438\u0441\u043a \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e API \u0441\u0430\u0439\u0442\u0430 \u0438\u043b\u0438 \u0423\u0441\u043a\u043e\u0440\u044f\u0435\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0432 10 \u0440\u0430\u0437<\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1a\/yi\/3j\/1ayi3jluxwebiankees5suyqhwu.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/1a\/yi\/3j\/1ayi3jluxwebiankees5suyqhwu.png\"\/><\/p>\n<p>  <\/p>\n<p><strong>\u0426\u0435\u043b\u044c \u0441\u0442\u0430\u0442\u044c\u0438<\/strong> \u2014 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e API \u0441\u0430\u0439\u0442\u0430.<br \/>  <strong>\u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438<\/strong> \u2014 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441\u0430\u0439\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0438\u0441\u043a\u0430 API \u0441\u0430\u0439\u0442\u0430 edadeal.ru, \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c google protobuf \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 <\/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-336679","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336679","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=336679"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336679\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}