File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,15 @@ docker run -d --net="host" --name youtube-dl -v /home/core/youtube-dl:/youtube-d
2121
2222### Docker Compose
2323
24- This is an example service definition that could be put in ` docker-compose.yml ` . This service uses a VPN client container for its networking.
24+ This is an example service definition that could be put in ` docker-compose.yml ` .
25+ This service uses a VPN client container for its networking and has a cookie file for downloading age-restricted videos.
2526
2627``` yml
2728 youtube-dl :
2829 image : " kmb32123/youtube-dl-server"
2930 network_mode : " service:vpn"
31+ environment :
32+ - YDL_COOKIE_FILE=youtube.com_cookies.txt
3033 volumes :
3134 - /home/core/youtube-dl:/youtube-dl
3235 restart : always
Original file line number Diff line number Diff line change @@ -111,14 +111,18 @@ def get_ydl_options(request_options):
111111 }
112112 )
113113
114- return {
114+ options = {
115115 "format" : ydl_vars ["YDL_FORMAT" ],
116116 "postprocessors" : postprocessors ,
117117 "outtmpl" : ydl_vars ["YDL_OUTPUT_TEMPLATE" ],
118118 "download_archive" : ydl_vars ["YDL_ARCHIVE_FILE" ],
119119 "updatetime" : ydl_vars ["YDL_UPDATE_TIME" ] == "True" ,
120120 }
121121
122+ if ydl_vars ["YDL_COOKIE_FILE" ]:
123+ options ["cookiefile" ] = f"/youtube-dl/{ ydl_vars ['YDL_COOKIE_FILE' ]} "
124+
125+ return options
122126
123127def download (url , request_options ):
124128 with YoutubeDL (get_ydl_options (request_options )) as ydl :
You can’t perform that action at this time.
0 commit comments