{"id":471523,"date":"2025-08-21T15:02:46","date_gmt":"2025-08-21T15:02:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=471523"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=471523","title":{"rendered":"<span>Youtube TG \u0431\u043e\u0442 \u043d\u0430 GO c\u043e \u0432\u0441\u0435\u043c\u0438 \u00ab\u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044f\u043c\u0438\u00bb<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c TG \u0431\u043e\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u00a0\u0441\u0438\u0445 \u043f\u043e\u0440 \u0430\u043a\u0442\u0443\u0430\u043b\u0435\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/h2>\n<p>\u0421\u0432\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441\u00a0\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c \u0431\u043e\u0442\u0430\u043c\u0438 \u044f \u043d\u0430\u0447\u0430\u043b \u043a\u0430\u043a\u00a0\u0440\u0430\u0437 \u0441\u00a0\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044e\u0442\u0443\u0431\u0431\u043e\u0442\u0430,\u00a0\u0431\u044b\u043b\u043e \u044d\u0442\u043e \u043e\u043a\u043e\u043b\u043e 5\u00a0\u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434. \u041f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u043e\u0442\u0430\u00a0\u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430\u00a0php, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u043e\u043d\u0430 \u043d\u0430\u00a0\u043a\u043e\u043b\u0435\u043d\u043a\u0435 \u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0440\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u043f\u043e\u0449\u0443\u043f\u0430\u0442\u044c \u0447\u0442\u043e\u00a0\u0442\u0430\u043a\u043e\u0435 \u0431\u043e\u0442\u044b \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043c\u043e\u044e \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432\u00a0\u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0438 \u0440\u043e\u043b\u0438\u043a\u043e\u0432 \u0441\u00a0\u044e\u0442\u0443\u0431\u0430. \u0412\u0435\u0440\u0441\u0438\u044f \u043d\u0430\u00a0php \u043f\u0440\u043e\u0436\u0438\u043b\u0430 \u043e\u043a\u043e\u043b\u043e 2-\u0445 \u043b\u0435\u0442, \u0431\u043e\u0442 \u0440\u043e\u0441,\u00a0\u0431\u044b\u043b \u043d\u0435\u0443\u0434\u043e\u0431\u0435\u043d \u0432\u00a0\u043f\u043b\u0430\u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0438 \u043a\u0430\u043a\u043e\u0433\u043e \u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u00a0\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0430\u00a0\u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u043e\u0442\u0430, \u043d\u043e\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u00a0\u043d\u0430\u00a0php, \u0430\u00a0\u0443\u0436\u0435 \u043d\u0430\u00a0GO, \u0442\u043e\u0433\u0434\u0430 \u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441\u00a0\u044f\u0437\u044b\u043a\u043e\u043c \u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u0430\u00a0\u0431\u044b\u043b\u0430 \u043a\u0430\u043a\u0430\u044f\u2011\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u00a0\u0431\u043e\u0442\u0435 \u0438 \u0434\u043b\u044f\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430\u00a0\u0435\u0433\u043e github:  <a href=\"https:\/\/github.com\/xman12\/youtube_bot\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/xman12\/youtube_bot<\/a><\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 <a class=\"mention\" href=\"\/users\/GetYoutubeMp3Bot\">@GetYoutubeMp3Bot<\/a><\/p>\n<h3>\u0410 \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442?<\/h3>\n<p>\u0412\u00a0\u0431\u043e\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u043a\u0430\u0447\u043a\u0430 \u0440\u043e\u043b\u0438\u043a\u043e\u0432 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 yt\u2011dlp. \u041f\u043e\u0441\u043b\u0435 \u0441\u043a\u0430\u0447\u043a\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 ffmpeg \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0430\u0443\u0434\u0438\u043e\u0434\u043e\u0440\u043e\u0436\u043a\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0422\u0430\u043a\u00a0\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438 \u043f\u0440\u0435\u0432\u044c\u044e \u0432\u0438\u0434\u0435\u043e \u043f\u043e\u00a0\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0430\u043c, \u043d\u0443 \u0438 \u0432\u0441\u0435).<\/p>\n<h2>\u0410 \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438?<\/h2>\n<p>\u0411\u043e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430\u00a0\u044f\u0437\u044b\u043a\u0435 GO, \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 Mysql, \u0434\u043b\u044f\u00a0\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Prometheus + Grafana \u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043e \u0432\u00a0Docker. <\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h3>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ea0\/4b0\/9d1\/ea04b09d19d752894862324004fa9908.png\" alt=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430\" title=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430\" width=\"3840\" height=\"1628\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/ea0\/4b0\/9d1\/ea04b09d19d752894862324004fa9908.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ea0\/4b0\/9d1\/ea04b09d19d752894862324004fa9908.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cf7\/f68\/b14\/cf7f68b14d64d42d8e7bed7d676af586.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\" width=\"3840\" height=\"2078\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/cf7\/f68\/b14\/cf7f68b14d64d42d8e7bed7d676af586.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cf7\/f68\/b14\/cf7f68b14d64d42d8e7bed7d676af586.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/figcaption><\/div>\n<\/figure>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u044d\u043a\u0435\u043d\u0434\u0430<\/h2>\n<p>\u0411\u044d\u043a\u0435\u043d\u0434 \u0431\u043e\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0Go \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 Telegram Bot API<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0438\u0434\u0435\u043e \u0441 YouTube \u0447\u0435\u0440\u0435\u0437 yt-dlp<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e<\/p>\n<\/li>\n<li>\n<p>\u0421\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f Prometheus<\/p>\n<\/li>\n<li>\n<p>\u0420\u043e\u0442\u0430\u0446\u0438\u044f HTTP-\u043f\u0440\u043e\u043a\u0441\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 <code>internal\/app\/server.go<\/code><\/p>\n<p>\u0425\u043e\u0442\u0435\u043b\u00a0\u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u00a0\u0440\u043e\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u043a\u0441\u0435\u0439. \u041e\u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u043f\u0443\u043b\u043b \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437\u00a0\u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 <code>yt-dlp<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bdd\/fc8\/78f\/bddfc878f7275968226d518095a945b1.png\" alt=\"\u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\" title=\"\u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\" width=\"3840\" height=\"2881\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/bdd\/fc8\/78f\/bddfc878f7275968226d518095a945b1.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bdd\/fc8\/78f\/bddfc878f7275968226d518095a945b1.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e \u0442\u0430\u043a\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043a\u0430\u0447\u0435\u043a \u0438 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e &#171;\u0441\u0434\u043e\u0445\u043d\u0443\u0442&#187;.<\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>\u0432 <code>server.go<\/code> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u043a\u0441\u0438<\/p>\n<pre><code class=\"go\">proxyKey := youtube.ProxyOption{ Key:  0, Path: os.Getenv(\"PATH_TO_PROXY\"), }<\/code><\/pre>\n<p>ProxyOption \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"go\">func GetProxy(option *ProxyOption) Proxy { collection := ParsFile(option.Path)  if len(collection)-1 == option.Key {  proxy := collection[option.Key] option.Key = 0  return proxy } else { proxy := collection[option.Key] option.Key++  return proxy } }<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u0435\u043c \u041e\u0431\u044a\u0435\u043a\u0442 Proxy \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043d\u0438\u043c.<\/p>\n<pre><code class=\"go\">proxy := GetProxy(proxyOption) args := fmt.Sprintf(\"yt-dlp --no-mtime --proxy %s -o \\\"%s\/%%(id)s.%%(ext)s\\\" \\\"%s\\\" --merge-output-format=\\\"mp4\/mkv\\\" -f w\", proxy.GetProxyString(), pathLoad, urlDownload)<\/code><\/pre>\n<p>\u0411\u043e\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 TelegramBotAPIServer, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<h2>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0431\u043e\u0442\u0430<\/h2>\n<p>\u0412 Docker \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b:<\/p>\n<ul>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 yt-dlp \u0440\u0430\u0437 \u0432 6 \u0447\u0430\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0447\u0438\u0449\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438\u043a\u043e\u0432 \u0440\u0430\u0437 \u0432 \u0447\u0430\u0441<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043c\u043f\u043e\u0440\u0442 \u0441\u0445\u0435\u043c\u044b \u0411\u0414 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u044d\u043a\u0430\u043f\u044b \u0438 \u0438\u0445 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c (\u0442\u0443\u0442 \u0432\u0441\u0435 \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 bash \u0441\u043a\u0440\u0438\u043f\u0442\u044b)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Mysql, Grafana, Prometheus \u043f\u043e IP <\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 1 \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<\/li>\n<\/ul>\n<h2>\u041c\u0435\u0442\u0440\u0438\u043a\u0438<\/h2>\n<p>\u0411\u043e\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>request_total<\/code>\u2013 \u041e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0431\u043e\u0442\u0443<\/p>\n<\/li>\n<li>\n<p><code>register_users_total<\/code> \u2013 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/p>\n<\/li>\n<li>\n<p><code>video_loads<\/code> \u2013 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0432\u0438\u0434\u0435\u043e<\/p>\n<\/li>\n<li>\n<p><code>video_loads_error<\/code> \u2013 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/p>\n<\/li>\n<\/ul>\n<h2>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<pre><code class=\"bash\">chmod +x start.sh .\/start.sh<\/code><\/pre>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d27\/b3f\/988\/d27b3f988c527461a850baae97bd011c.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u043e\u0442\u0430\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u043e\u0442\u0430\" width=\"1690\" height=\"1390\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d27\/b3f\/988\/d27b3f988c527461a850baae97bd011c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d27\/b3f\/988\/d27b3f988c527461a850baae97bd011c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u043e\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/xman12\/youtube_bot\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/xman12\/youtube_bot<\/a><\/p>\n<p>PS. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0442\u0435\u043c \u043a\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0411\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d \u0437\u0430 \u0438\u0434\u0435\u0438 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/939436\/\"> https:\/\/habr.com\/ru\/articles\/939436\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c TG \u0431\u043e\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u00a0\u0441\u0438\u0445 \u043f\u043e\u0440 \u0430\u043a\u0442\u0443\u0430\u043b\u0435\u043d \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/h2>\n<p>\u0421\u0432\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441\u00a0\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c \u0431\u043e\u0442\u0430\u043c\u0438 \u044f \u043d\u0430\u0447\u0430\u043b \u043a\u0430\u043a\u00a0\u0440\u0430\u0437 \u0441\u00a0\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044e\u0442\u0443\u0431\u0431\u043e\u0442\u0430,\u00a0\u0431\u044b\u043b\u043e \u044d\u0442\u043e \u043e\u043a\u043e\u043b\u043e 5\u00a0\u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434. \u041f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u043e\u0442\u0430\u00a0\u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430\u00a0php, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u043e\u043d\u0430 \u043d\u0430\u00a0\u043a\u043e\u043b\u0435\u043d\u043a\u0435 \u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0440\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u043f\u043e\u0449\u0443\u043f\u0430\u0442\u044c \u0447\u0442\u043e\u00a0\u0442\u0430\u043a\u043e\u0435 \u0431\u043e\u0442\u044b \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043c\u043e\u044e \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432\u00a0\u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0438 \u0440\u043e\u043b\u0438\u043a\u043e\u0432 \u0441\u00a0\u044e\u0442\u0443\u0431\u0430. \u0412\u0435\u0440\u0441\u0438\u044f \u043d\u0430\u00a0php \u043f\u0440\u043e\u0436\u0438\u043b\u0430 \u043e\u043a\u043e\u043b\u043e 2-\u0445 \u043b\u0435\u0442, \u0431\u043e\u0442 \u0440\u043e\u0441,\u00a0\u0431\u044b\u043b \u043d\u0435\u0443\u0434\u043e\u0431\u0435\u043d \u0432\u00a0\u043f\u043b\u0430\u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0438 \u043a\u0430\u043a\u043e\u0433\u043e \u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u00a0\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433, \u0430\u00a0\u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u043e\u0442\u0430, \u043d\u043e\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u00a0\u043d\u0430\u00a0php, \u0430\u00a0\u0443\u0436\u0435 \u043d\u0430\u00a0GO, \u0442\u043e\u0433\u0434\u0430 \u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441\u00a0\u044f\u0437\u044b\u043a\u043e\u043c \u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u0430\u00a0\u0431\u044b\u043b\u0430 \u043a\u0430\u043a\u0430\u044f\u2011\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u00a0\u0431\u043e\u0442\u0435 \u0438 \u0434\u043b\u044f\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430\u00a0\u0435\u0433\u043e github:  <a href=\"https:\/\/github.com\/xman12\/youtube_bot\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/xman12\/youtube_bot<\/a><\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 <a class=\"mention\" href=\"\/users\/GetYoutubeMp3Bot\">@GetYoutubeMp3Bot<\/a><\/p>\n<h3>\u0410 \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442?<\/h3>\n<p>\u0412\u00a0\u0431\u043e\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u043a\u0430\u0447\u043a\u0430 \u0440\u043e\u043b\u0438\u043a\u043e\u0432 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 yt\u2011dlp. \u041f\u043e\u0441\u043b\u0435 \u0441\u043a\u0430\u0447\u043a\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 ffmpeg \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0430\u0443\u0434\u0438\u043e\u0434\u043e\u0440\u043e\u0436\u043a\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0422\u0430\u043a\u00a0\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438 \u043f\u0440\u0435\u0432\u044c\u044e \u0432\u0438\u0434\u0435\u043e \u043f\u043e\u00a0\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0430\u043c, \u043d\u0443 \u0438 \u0432\u0441\u0435).<\/p>\n<h2>\u0410 \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438?<\/h2>\n<p>\u0411\u043e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430\u00a0\u044f\u0437\u044b\u043a\u0435 GO, \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 Mysql, \u0434\u043b\u044f\u00a0\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Prometheus + Grafana \u0438 \u0432\u0441\u0435 \u044d\u0442\u043e \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043e \u0432\u00a0Docker. <\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h3>\n<figure class=\"full-width\">\n<div><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/figcaption><\/div>\n<\/figure>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u044d\u043a\u0435\u043d\u0434\u0430<\/h2>\n<p>\u0411\u044d\u043a\u0435\u043d\u0434 \u0431\u043e\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0Go \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 Telegram Bot API<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0438\u0434\u0435\u043e \u0441 YouTube \u0447\u0435\u0440\u0435\u0437 yt-dlp<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e<\/p>\n<\/li>\n<li>\n<p>\u0421\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f Prometheus<\/p>\n<\/li>\n<li>\n<p>\u0420\u043e\u0442\u0430\u0446\u0438\u044f HTTP-\u043f\u0440\u043e\u043a\u0441\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 <code>internal\/app\/server.go<\/code><\/p>\n<p>\u0425\u043e\u0442\u0435\u043b\u00a0\u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u00a0\u0440\u043e\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u043a\u0441\u0435\u0439. \u041e\u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u043f\u0443\u043b\u043b \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437\u00a0\u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 <code>yt-dlp<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e \u0442\u0430\u043a\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043a\u0430\u0447\u0435\u043a \u0438 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e &#171;\u0441\u0434\u043e\u0445\u043d\u0443\u0442&#187;.<\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>\u0432 <code>server.go<\/code> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u043a\u0441\u0438<\/p>\n<pre><code class=\"go\">proxyKey := youtube.ProxyOption{ Key:  0, Path: os.Getenv(\"PATH_TO_PROXY\"), }<\/code><\/pre>\n<p>ProxyOption \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"go\">func GetProxy(option *ProxyOption) Proxy { collection := ParsFile(option.Path)  if len(collection)-1 == option.Key {  proxy := collection[option.Key] option.Key = 0  return proxy } else { proxy := collection[option.Key] option.Key++  return proxy } }<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u0435\u043c \u041e\u0431\u044a\u0435\u043a\u0442 Proxy \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043d\u0438\u043c.<\/p>\n<pre><code class=\"go\">proxy := GetProxy(proxyOption) args := fmt.Sprintf(\"yt-dlp --no-mtime --proxy %s -o \\\"%s\/%%(id)s.%%(ext)s\\\" \\\"%s\\\" --merge-output-format=\\\"mp4\/mkv\\\" -f w\", proxy.GetProxyString(), pathLoad, urlDownload)<\/code><\/pre>\n<p>\u0411\u043e\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 TelegramBotAPIServer, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<h2>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0431\u043e\u0442\u0430<\/h2>\n<p>\u0412 Docker \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b:<\/p>\n<ul>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 yt-dlp \u0440\u0430\u0437 \u0432 6 \u0447\u0430\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0447\u0438\u0449\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438\u043a\u043e\u0432 \u0440\u0430\u0437 \u0432 \u0447\u0430\u0441<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043c\u043f\u043e\u0440\u0442 \u0441\u0445\u0435\u043c\u044b \u0411\u0414 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u044d\u043a\u0430\u043f\u044b \u0438 \u0438\u0445 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c (\u0442\u0443\u0442 \u0432\u0441\u0435 \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 bash \u0441\u043a\u0440\u0438\u043f\u0442\u044b)<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Mysql, Grafana, Prometheus \u043f\u043e IP <\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 1 \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<\/li>\n<\/ul>\n<h2>\u041c\u0435\u0442\u0440\u0438\u043a\u0438<\/h2>\n<p>\u0411\u043e\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>request_total<\/code>\u2013 \u041e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0431\u043e\u0442\u0443<\/p>\n<\/li>\n<li>\n<p><code>register_users_total<\/code> \u2013 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/p>\n<\/li>\n<li>\n<p><code>video_loads<\/code> \u2013 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0432\u0438\u0434\u0435\u043e<\/p>\n<\/li>\n<li>\n<p><code>video_loads_error<\/code> \u2013 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/p>\n<\/li>\n<\/ul>\n<h2>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<pre><code class=\"bash\">chmod +x start.sh .\/start.sh<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u043e\u0442\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/xman12\/youtube_bot\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/xman12\/youtube_bot<\/a><\/p>\n<p>PS. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0442\u0435\u043c \u043a\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0411\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d \u0437\u0430 \u0438\u0434\u0435\u0438 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/939436\/\"> https:\/\/habr.com\/ru\/articles\/939436\/<\/a><br \/><\/br><\/br><\/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-471523","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471523","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=471523"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471523\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=471523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=471523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=471523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}