{"id":923,"date":"2018-12-12T16:51:56","date_gmt":"2018-12-13T01:51:56","guid":{"rendered":"\/blog\/?p=923"},"modified":"2023-09-21T09:37:26","modified_gmt":"2023-09-21T00:37:26","slug":"youtube-dl-%ec%9c%a0%ed%8a%9c%eb%b8%8c-%eb%8b%a4%ec%9a%b4%eb%a1%9c%eb%93%9c-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=923","title":{"rendered":"[youtube-dl] \uc720\ud29c\ube0c \ub2e4\uc6b4\ub85c\ub4dc \uc2a4\ud06c\ub9bd\ud2b8"},"content":{"rendered":"<p><span style=\"font-family: Gulim,Dotum,NanumGothic,Arial Unicode MS,Tahoma,MS Serif;\">\uc0ac\uc6a9\ubc29\ubc95:<\/span><\/p>\n<p><span style=\"font-family: Gulim,Dotum,NanumGothic,Arial Unicode MS,Tahoma,MS Serif;\">1. .\/youtube_urls.txt \ud3b8\uc9d1<\/span><\/p>\n<p><span style=\"font-family: Gulim,Dotum,NanumGothic,Arial Unicode MS,Tahoma,MS Serif;\">2. nohup .\/download_youtube.sh -f &amp;<\/span><\/p>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\n############################################################\n#\n# YouTube \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc \uc2a4\ud06c\ub9bd\ud2b8\n#\n############################################################\n\nOUTPUT_DIR=\/usbmem\/youtube\nURLS_FILE=\".\/youtube_urls.txt\"\nDEFAULT_VIDEO_OPTS=\"--write-auto-sub --sub-lang ko\"\nDEFAULT_AUDIO_OPTS=\"--extract-audio --audio-format mp3 --audio-quality 0\"\nmkdir -p ${OUTPUT_DIR}\n\ndisplay_usage() {\n  echo \"### \uc720\ud29c\ube0c \ub2e4\uc6b4\ub85c\ub354 ###\"\n  echo\n  echo \"Usage:\"\n  echo \"$0 -h or --help:  \ub3c4\uc6c0\ub9d0\"\n  echo \"$0 -ug: youtube-dl \ud328\ud0a4\uc9c0 \uc5c5\uadf8\ub808\uc774\ub4dc\"\n  echo \"$0 -f:  ${URLS_FILE} \ud30c\uc77c\uc5d0\uc11c YouTube \uc8fc\uc18c\ub97c \uc77d\uc5b4\uc11c \ube44\ub514\uc624 \ub2e4\uc6b4\ub85c\ub4dc\"\n  echo \"$0 -vh {youtube \uc8fc\uc18c}:  \ubc31\uadf8\ub77c\uc6b4\ub4dc\uc5d0\uc11c \ube44\ub514\uc624 \ub2e4\uc6b4\ub85c\ub4dc\"\n  echo \"$0 -vn {youtube \uc8fc\uc18c}:  \ud3ec\uadf8\ub77c\uc6b4\ub4dc\uc5d0\uc11c \ube44\ub514\uc624 \ub2e4\uc6b4\ub85c\ub4dc\"\n  echo \"$0 -ah {youtube \uc8fc\uc18c}:  \ubc31\uadf8\ub77c\uc6b4\ub4dc\uc5d0\uc11c \uc624\ub514\uc624\ub9cc \ub2e4\uc6b4\ub85c\ub4dc\"\n  echo \"$0 -an {youtube \uc8fc\uc18c}:  \ud3ec\uadf8\ub77c\uc6b4\ub4dc\uc5d0\uc11c \uc624\ub514\uc624\ub9cc \ub2e4\uc6b4\ub85c\ub4dc\"\n}\n\nread_file() {\n  while read READ_STRING\n  do\n    STRLEN=`echo -n $READ_STRING | wc -c`\n    if [ ${STRLEN=} -gt 20 ]\n    then\n      echo ${READ_STRING}\n      youtube-dl ${DEFAULT_VIDEO_OPTS} -o \"${OUTPUT_DIR}\/%(title)s.%(ext)s\" ${READ_STRING}\n    fi\n  done &lt; ${URLS_FILE}\n}\n\ncase $1 in\n  \"-ug\") echo \"Upgrade Package\"\n    pip install --upgrade pip\n    pip install --upgrade -q youtube-dl\n    ;;\n\n  \"-f\") echo \"YouTube URL list fIle: ${URLS_FILE}\"\n    read_file\n    ;;\n\n  \"-vh\") echo \"Youtube download (nohup): $2\"\n    nohup youtube-dl ${DEFAULT_VIDEO_OPTS} -o \"${OUTPUT_DIR}\/%(title)s.%(ext)s\" $2 &amp;\n    ;;\n\n  \"-vn\") echo \"Youtube download: $2\"\n    youtube-dl ${DEFAULT_VIDEO_OPTS} -o \"${OUTPUT_DIR}\/%(title)s.%(ext)s\" $2\n    ;;\n\n  \"-ah\") echo \"Youtube download audio only (nohup): $2\"\n    nohup youtube-dl ${DEFAULT_AUDIO_OPTS} ${DEFAULT_VIDEO_OPTS} -o \"${OUTPUT_DIR}\/%(title)s.%(ext)s\" $2 &amp;\n    ;;\n\n  \"-an\") echo \"Youtube download audio only: $2\"\n    youtube-dl ${DEFAULT_AUDIO_OPTS} ${DEFAULT_VIDEO_OPTS} -o \"${OUTPUT_DIR}\/%(title)s.%(ext)s\" $2\n    ;;\n\n  \"-h\") display_usage\n    ;;\n\n  \"--help\") display_usage\n    ;;\n\n  *) echo \"Youtube download: $2\"\n    youtube-dl ${DEFAULT_VIDEO_OPTS} -o \"${OUTPUT_DIR}\/%(title)s.%(ext)s\" $2\n    ;;\nesac<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uc0ac\uc6a9\ubc29\ubc95: 1. .\/youtube_urls.txt \ud3b8\uc9d1 2. nohup .\/download_youtube.sh -f &amp;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[15],"tags":[],"class_list":["post-923","post","type-post","status-publish","format-standard","hentry","category-computing_tools"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=923"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/923\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}