{"id":13479290,"url":"https://github.com/jim60105/docker-youtube-dl","last_synced_at":"2025-03-27T09:31:06.428Z","repository":{"id":107553623,"uuid":"319731379","full_name":"jim60105/docker-youtube-dl","owner":"jim60105","description":"Youtube錄影伺服器 (Docker Compose) https://blog.maki0419.com/2020/11/docker-youtube-dl-auto-recording-live-dl.html","archived":true,"fork":false,"pushed_at":"2022-09-25T17:21:11.000Z","size":135,"stargazers_count":25,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T12:48:44.254Z","etag":null,"topics":["docker","docker-compose","vtuber","youtube","youtube-dl","youtube-dl-gui","youtube-downloader","youtube-stream"],"latest_commit_sha":null,"homepage":"https://blog.maki0419.com/2020/11/docker-youtube-dl-auto-recording-live-dl.html","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jim60105.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-08T18:51:07.000Z","updated_at":"2023-11-15T22:02:54.000Z","dependencies_parsed_at":"2023-06-08T12:00:09.402Z","dependency_job_id":null,"html_url":"https://github.com/jim60105/docker-youtube-dl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-youtube-dl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-youtube-dl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-youtube-dl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jim60105%2Fdocker-youtube-dl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jim60105","download_url":"https://codeload.github.com/jim60105/docker-youtube-dl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245817393,"owners_count":20677282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","vtuber","youtube","youtube-dl","youtube-dl-gui","youtube-downloader","youtube-stream"],"created_at":"2024-07-31T16:02:12.937Z","updated_at":"2025-03-27T09:31:06.179Z","avatar_url":"https://github.com/jim60105.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# youtube-dl Services on docker \u0026 Auto clean up\n\u003e 本專案從屬於 [jim60105/docker-ReverseProxy](https://github.com/jim60105/docker-ReverseProxy)\\\n\u003e 本專案logging經過調整，可搭配[jim60105/docker-Seq](https://github.com/jim60105/docker-Seq)使用\n\n**請參考 [琳的備忘手札 Youtube直播錄影伺服器建置](https://blog.maki0419.com/2020/11/docker-youtube-dl-auto-recording-live-dl.html)**\n\n本專案希望建置起能永久自動運作的Youtube直播備份機\\\n此專案目標定位為「錄影備份」，在發生直播主事後砍檔時，我才會到伺服器尋找備份\\\n是故，本專案不著重在錄影後的檔案處理，而是在磁碟滿時做自動刪檔\n\n## 架構\nWWW\\\n│\\\nnginx Server (Reverse Proxy) (SSL證書申請、Renew)\\\n├ Jobber (Cron) (定時檢查磁碟使用率，在高於設定之百分比時，自動由舊起刪除錄影)\\\n├ live-dl (直播監控錄影機)\\\n└ youtube-dl-server (WebUI下載器)\n\n## 說明\n* 錄影和下載會儲存在主機的 `../YoutubeRecordings/` 之下，可以在 [docker-compose.yml](docker-compose.yml)修改\n* 可以在錄影完成後執行callback bash script\n* Jobber會在每日的01:00 UTC檢查磁碟使用率，並由舊檔案刪起，直到磁碟使用率降到設定值(或直到沒有檔案)\n\n## 部屬\n\u003e **本專案有submodule**\\\n\u003e 如果想要build docker image，請用`git pull --recurse-submodules`\n \n* 請參考 [`.env_sample`](.env_sample) 建立 `.env`\n    * `LETSENCRYPT_EMAIL`=你的email\n    * `HOST`=WebUI網址\n    * `DelPercentage`=要執行刪除功能的磁碟使用百分比\n    * `LOGSERVER`=GELF log server位置，詳細請參照後文\n* 請編輯 [`config_live-dl.yml`](config_live-dl.yml) 在map處建立名稱表，**此表用於自動錄播時的資料夾建立**\n    ```yml\n    - name: 久遠たま\n      youtube: https://www.youtube.com/channel/UCBC7vYFNQoGPupe5NxPG4Bw\n    ```\n* 請參考 [`Monitor/tama.sh`](Monitor/tama.sh) 建立要自動錄播的頻道，所有Monitor下的檔案都會被執行\n```sh\nnohup /bin/bash live-dl {{Youtube URL}} \u0026\u003e/youtube-dl/logs/live-dl-{{Channel Name}}.$(date +%d%b%y-%H%M%S).log \u0026\n```\n* 給*.sh執行權限 `find ./ -type f -iname \"*.sh\" -exec chmod +x {} \\;`\n* 正式發佈前移除 `.env` 中的 `LETSENCRYPT_TEST=true`\\\n此設定為SSL測試證書\\\n正式版有申請次數上限，務必在測試正常、最後上線前再移除\n\n## 下載會員限定影片\nyoutube-dl支援以cookie的方式登入，可以下載會限影片\n\u003e youtube-dl的帳密功能**目前確定是壞的**，只能以cookies方式登入\\\n\u003e 此cookies file包含了你的Youtube登入授權，請務必妥善保管\n* 安裝瀏覧器擴充功能，以匯出Netscape HTTP Cookie File\n    * Chrome: [Get cookies.txt](https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid)\n    * Firefox: [cookies.txt](https://addons.mozilla.org/zh-TW/firefox/addon/cookies-txt/)\n* 瀏覧至Youtube網頁，登入你的帳號\n* 以擴充功能匯出`youtube.com`網域的所有cookie\n* 將匯出之cookie檔案重命名為`cookies.txt`\n* 取代專案根目錄下的[cookies.txt](cookies.txt)檔，或用於docker run時的volume bind\n\n## 錄影完成Callback\n如果需要在下載完成後回呼，請修改[docker-compose.yml](docker-compose.yml)，將回呼腳本bind至livedl之下的/usr/src/app/callback.sh\n\u003e 本專案提供的 [download_again.sh](download_again.sh) ，能在下載完成後等待一分鐘，再下載第二次\\\n\u003e 由於串流中錄影容易有漏秒，這功能用於「直播結束後至Youtube版權砲前」再下載一次\n\n### callback.sh傳入之參數:\n```bash\n__info \"Calling callback function...\"\nlocal cmd=( \"$CALLBACK_EXEC\" \"${OUTPUT_PATH}.mp4\" \"$BASE_DIR/\" \"$VIDEO_ID\" \"$FULLTITLE\" \"$UPLOADER\" \"$UPLOAD_DATE\" )\nnohup \"${cmd[@]}\" \u0026\u003e\u003e \"$OUTPUT_PATH.log\" \u0026\n```\nbash參數\n1. 產出檔案的完整路徑\n1. 產出檔案之所在資料夾\n1. 影片id\n1. 影片標題\n1. 影片上傳者\n1. 上傳日期\n\n## Logging相關設定\n本專案logging經過調整，可搭配[Seq Log Server](https://datalust.co/seq)使用 (或是任何支援GELF http post的log server)\\\n* 參考這個repo部屬Seq: https://github.com/jim60105/docker-Seq\n* .env正確設置LOGSERVER路徑，格式為`IP:埠號`\n* Monitor/*.sh註解掉File logging，改用「STDOUT logging (with log tag)」方式呼叫\n* download_again.sh註解掉File logging，改用「Docker logs logging (with log tag)」方式呼叫\n* 啟動指令改用`docker-compose -f docker-compose.yml -f docker-compose.log-server.yml up -d`\\\n或是將`docker-compose.log-server.yml`重命名為`docker-compose.override.yml`，使`docker-compose up -d`可以自動應用override檔\n\n## LICENSE: AGPL-3.0 License \n本專案使用AGPL-3.0，遵循自 [sparanoid/live-dl](https://github.com/sparanoid/live-dl)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjim60105%2Fdocker-youtube-dl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjim60105%2Fdocker-youtube-dl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjim60105%2Fdocker-youtube-dl/lists"}