{"id":1301,"date":"2019-02-15T17:58:51","date_gmt":"2019-02-15T08:58:51","guid":{"rendered":"https:\/\/yuis-programming.com\/?p=1301"},"modified":"2021-10-16T18:11:33","modified_gmt":"2021-10-16T09:11:33","slug":"awesome-youtube-dl-snippet%e3%81%93%e3%82%8c%e8%a6%8b%e3%81%a8%e3%81%91%e3%81%b0%e9%96%93%e9%81%95%e3%81%84%e3%81%aa%e3%81%84%e6%9c%80%e5%bc%b7youtube-dl%e3%82%b9%e3%82%af%e3%83%aa%e3%83%97%e3%83%88","status":"publish","type":"post","link":"https:\/\/yuis-programming.com\/?p=1301","title":{"rendered":"youtube-dl\u30b3\u30de\u30f3\u30c9\u306e\u4f7f\u3044\u65b9\u30fb\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u89e3\u8aac"},"content":{"rendered":"<p>Windows\u304a\u3088\u3073Linux\u30d1\u30bd\u30b3\u30f3\u30fb\u30b5\u30fc\u30d0\u30fc\u3067\u4f7f\u7528\u53ef\u80fd\u306ayoutube\u3001\u30cb\u30b3\u30cb\u30b3\u52d5\u753b\u3001bilibili\u52d5\u753b\u3084\u305d\u306e\u4ed6\u52d5\u753b\u30b5\u30a4\u30c8\u306e\u52d5\u753b\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3092\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3001youtube-dl\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306eyoutube-dl\u30b3\u30de\u30f3\u30c9\u306e\u4f7f\u3044\u65b9\u30fb\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u89e3\u8aac\u3001\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u3002(\u30d5\u30a1\u30a4\u30eb\u51fa\u529b\u5148\u306e\u30d1\u30b9\u306a\u3069\u3084URL\u306a\u3069\u5909\u3048\u3066\u30b3\u30d4\u30da\u3057\u3066\u4f7f\u3048\u307e\u3059)<\/p>\n<pre><code>LC_ALL=en_US.UTF-8 \\\nyoutube-dl -i -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]\/best[ext=mp4]\/best' -v \\\n-o \"\/mnt\/e\/_videos\/_youtube_dl\/tmp\/%(id)s--%(title)s--%(uploader)s.%(ext)s\" \\\n--cookies \/home\/data\/youtube-dl\/cookie.txt --download-archive \/home\/data\/youtube-dl\/archive.txt \\\n--embed-subs --embed-thumbnail --write-info-json --all-subs --sub-format srt \\\n\"[URL]\"\n\n<\/code><\/pre>\n<p>\u89e3\u8aac\u3002<\/p>\n<pre><code># In a case of containing such as Japanese you'd add this line ; \u65e5\u672c\u8a9e\u30c6\u30ad\u30b9\u30c8\u306a\u3069\u3092\u542b\u3093\u3067\u3044\u308b\u5834\u5408\u306b\u306f\u6587\u5b57\u30b3\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\nLC_ALL=en_US.UTF-8 \\\n\nyoutube-dl -i -f bestaudio -v \\\n\n# destination setting up ; \u30d5\u30a1\u30a4\u30eb\u306e\u53d6\u5f97\u5148\u3092\u8a2d\u5b9a\u3057\u307e\u3059\n-o \"\/mnt\/e\/_videos\/_youtube_dl\/%(id)s--%(title)s--%(uploader)s.%(ext)s\" \\\n\n# Use --cookies option when you'd like to dl for private playlist or videos\n--cookies \/home\/data\/youtube-dl\/cookie.txt --download-archive \/home\/data\/youtube-dl\/archive.txt \\\n\n# my favorite opts :-) \u304a\u6c17\u306b\u5165\u308a\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\n# embedding subs if exist ; embedding thums to ; create a json file written infomation of the video ; define subtitle format as\n--embed-subs --embed-thumbnail --write-info-json --all-subs --sub-format srt \\\n\n# not sure. \u3042\u307e\u308a\u5206\u304b\u3089\u306a\u3044\n# --add-metadata  --convert-subs srt\n\n<\/code><\/pre>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#mp4\"><span class=\"toc_number toc_depth_1\">1<\/span> \u6700\u9ad8\u753b\u8cea\u30fb\u6700\u9ad8\u97f3\u8cea\u306emp4\u3067\u4fdd\u5b58<\/a><\/li><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">2<\/span> \u51fa\u529b\u30d5\u30a9\u30eb\u30c0\u3092\u5909\u66f4<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_1\">3<\/span> \u6587\u5b57\u30b3\u30fc\u30c9\u6307\u5b9a\u3067\u6587\u5b57\u5316\u3051\u3092\u9632\u3050<\/a><\/li><li><a href=\"#cookie\"><span class=\"toc_number toc_depth_1\">4<\/span> cookie\u3092\u6307\u5b9a\u3059\u308b<\/a><\/li><li><a href=\"#i-3\"><span class=\"toc_number toc_depth_1\">5<\/span> \u5b57\u5e55\u4fdd\u5b58\u30fb\u30b5\u30e0\u30cd\u30a4\u30eb\u4fdd\u5b58\u30fb\u52d5\u753b\u60c5\u5831\u4fdd\u5b58\u30fb\u5b57\u5e55\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58<\/a><\/li><li><a href=\"#i-4\"><span class=\"toc_number toc_depth_1\">6<\/span> \u4e00\u5ea6\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u52d5\u753b\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b<\/a><\/li><\/ul><\/div>\n<h2><span id=\"mp4\">\u6700\u9ad8\u753b\u8cea\u30fb\u6700\u9ad8\u97f3\u8cea\u306emp4\u3067\u4fdd\u5b58<\/span><\/h2>\n<pre><code>-f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]\/best[ext=mp4]\/best'\n<\/code><\/pre>\n<p>\u3061\u3087\u3063\u3068\u8907\u96d1\u3067\u3059\u304c\u3001\u7c21\u5358\u306b\u8a33\u3059\u3068\u3001<\/p>\n<pre><code>mp4\u5f62\u5f0f\u3068m4a\u5f62\u5f0f\u3067\u4fdd\u5b58\u3059\u308b\n    if \u3067\u304d\u306a\u304b\u3063\u305f(mp4\u306f\u3067\u304d\u305f\u304cm4a\u3067\u51fa\u529b\u3067\u304d\u306a\u304b\u3063\u305f\u306a\u3069):\n        mp4\u3067\u4fdd\u5b58\u3059\u308b\n            if \u3067\u304d\u306a\u304b\u3063\u305f:\n                \u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5f62\u5f0f\u554f\u308f\u305a\u4e00\u756a\u826f\u3044\u3084\u3064\u3067\u4fdd\u5b58\u3059\u308b(\u306a\u3063\u305f\u3053\u3068\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u78ba\u8a3c\u306f\u306a\u3044\u3067\u3059\u304c\u305f\u3076\u3093\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308b\u306e\u3067\u306f\u3002)\n<\/code><\/pre>\n<p>\u307f\u305f\u3044\u306a\u611f\u3058\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2><span id=\"i\">\u51fa\u529b\u30d5\u30a9\u30eb\u30c0\u3092\u5909\u66f4<\/span><\/h2>\n<pre><code>-o\n<\/code><\/pre>\n<h2><span id=\"i-2\">\u6587\u5b57\u30b3\u30fc\u30c9\u6307\u5b9a\u3067\u6587\u5b57\u5316\u3051\u3092\u9632\u3050<\/span><\/h2>\n<pre><code>LC_ALL=en_US.UTF-8\n<\/code><\/pre>\n<p>\u3053\u308c\u3057\u306a\u3044\u3068\u30bf\u30a4\u30c8\u30eb\u304c\u6587\u5b57\u5316\u3051<br \/>\n\u3082\u3061\u308d\u3093<code>export<\/code>\u3092bashrc\u306b\u66f8\u3044\u3066\u3082\u3044\u3044\u3068\u601d\u3046\u3002<\/p>\n<h2><span id=\"cookie\">cookie\u3092\u6307\u5b9a\u3059\u308b<\/span><\/h2>\n<pre><code>--cookies cookie.txt \n<\/code><\/pre>\n<p>\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306a\u975e\u516c\u958b\u52d5\u753b\u3092\u843d\u3068\u3057\u305f\u3044\u5834\u5408\u3001\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306a\u30d7\u30ec\u30a4\u30ea\u30b9\u30c8\u7b49\u306e\u5834\u5408\u3001Cookie\u3092\u6307\u5b9a\u3057\u3066\u3084\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u306e\u62e1\u5f35\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001youtube\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3001\u958b\u304f\u3068\u3001Cookie\u304c\u4e00\u89a7\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u5168\u9078\u629e\u3057\u3066\u3084\u308b\u3002<\/p>\n<p><a href=\"https:\/\/chrome.google.com\/webstore\/detail\/cookiestxt\/njabckikapfpffapmjgojcnbfjonfjfg\">cookies.txt &#8211; Chrome Web Store<\/a><\/p>\n<p><code>cat &gt; \/home\/data\/youtube-dl\/cookie.txt<\/code>\u306a\u3069\u3067\u30da\u30fc\u30b9\u30c8\u3002<\/p>\n<p>youtube-dl\u306b<code>--cookies \/home\/data\/youtube-dl\/cookie.txt<\/code>\u3092\u3064\u3051\u3066\u3084\u308b\u3068Cookie\u3092\u81ea\u52d5\u3067\u4ed8\u3051\u3066\u975e\u516c\u958bURL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304d\u3066\u304f\u308c\u308b\u3002<\/p>\n<p>Liked video(\u9ad8\u304f\u8a55\u4fa1\u3057\u305f\u52d5\u753b)\u306a\u3069\u306b\u3088\u304f\u4f7f\u7528\u3059\u308b\u4e8b\u304c\u591a\u3044\u3002<\/p>\n<h2><span id=\"i-3\">\u5b57\u5e55\u4fdd\u5b58\u30fb\u30b5\u30e0\u30cd\u30a4\u30eb\u4fdd\u5b58\u30fb\u52d5\u753b\u60c5\u5831\u4fdd\u5b58\u30fb\u5b57\u5e55\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58<\/span><\/h2>\n<pre><code>--embed-subs --embed-thumbnail --write-info-json --all-subs --sub-format srt \n<\/code><\/pre>\n<p>\u3053\u3061\u3089\u306f\u597d\u307f\u3067\u3059\u304c\u3001\u3082\u3057\u52d5\u753b\u304c\u6d88\u3055\u308c\u305f\u6642\u3001\u3042\u30fc\u3082\u3063\u3068\u60c5\u5831\u307b\u3057\u304b\u3063\u305f\u306a\u3041\u2026\u3068\u306a\u308b\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3001\u4fdd\u5b58\u3067\u304d\u308b\u3082\u306e\u306f\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u826f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n<code>--embed-subs<\/code>\u306f\u7121\u3044\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3057\u308c\u306a\u304b\u3063\u305f\u3067\u3059\u306d\u3002\u5404\u81ea\u6d88\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2><span id=\"i-4\">\u4e00\u5ea6\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u52d5\u753b\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b<\/span><\/h2>\n<pre><code>--download-archive \/home\/data\/youtube-dl\/archive.txt \n<\/code><\/pre>\n<p>\u4e00\u5ea6\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305fURL\u306f\u30a2\u30fc\u30ab\u30a4\u30d6\u306b\u4fdd\u7ba1\u3057\u3066\u3001\u518d\u5ea6\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3068\u304d\u306b\u30a2\u30fc\u30ab\u30a4\u30d6\u306bURL\u304c\u3042\u308c\u3070\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u3001\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<br \/>\n\u3064\u307e\u308a\u91cd\u8907\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3092\u9632\u304e\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30fc\u30ab\u30a4\u30d6\u3092\u30ea\u30bb\u30c3\u30c8\u3057\u305f\u3044\u3068\u304d\u306f<code>&gt; archive.txt<\/code>\u3002<\/p>\n<hr>\n<p>\u3088\u304b\u3063\u305f\u3089\u3002<\/p>\n<pre><code>\nydl(){\n    LC_ALL=en_US.UTF-8 \\\n    youtube-dl -i -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]\/best[ext=mp4]\/best' -v \\\n    -o \"\/mnt\/e\/_videos\/_youtube_dl\/tmp\/%(id)s--%(title)s--%(uploader)s.%(ext)s\" \\\n    --cookies \/home\/data\/youtube-dl\/cookie.txt --download-archive \/home\/data\/youtube-dl\/archive.txt \\\n    --embed-subs --embed-thumbnail --write-info-json --all-subs --sub-format srt \\\n    \"$(cuturlquerystr \"$1\")\"\n}\n\nalias ydlarcbak=\"cp \/home\/data\/youtube-dl\/archive.txt \/home\/data\/youtube-dl\/archive.txt.$(plaindate).bak\"\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Windows\u304a\u3088\u3073Linux\u30d1\u30bd\u30b3\u30f3\u30fb\u30b5\u30fc\u30d0\u30fc\u3067\u4f7f\u7528\u53ef\u80fd\u306ayoutube\u3001\u30cb\u30b3\u30cb\u30b3\u52d5\u753b\u3001bilibili\u52d5\u753b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[63],"tags":[],"acf":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8Rxwo-kZ","_links":{"self":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1301"}],"collection":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1301"}],"version-history":[{"count":5,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1301\/revisions"}],"predecessor-version":[{"id":3000,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1301\/revisions\/3000"}],"wp:attachment":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}