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 @@ -20,12 +20,15 @@ docker run -d --net="host" --name youtube-dl -v /home/core/youtube-dl:/youtube-d
2020
2121### Docker Compose
2222
23- This is an example service definition that could be put in ` docker-compose.yml ` . This service uses a VPN client container for its networking.
23+ This is an example service definition that could be put in ` docker-compose.yml ` .
24+ This service uses a VPN client container for its networking and has a cookie file for downloading age-restricted videos.
2425
2526``` yml
2627 youtube-dl :
2728 image : " kmb32123/youtube-dl-server"
2829 network_mode : " service:vpn"
30+ environment :
31+ - YDL_COOKIE_FILE=youtube.com_cookies.txt
2932 volumes :
3033 - /home/core/youtube-dl:/youtube-dl
3134 restart : always
Original file line number Diff line number Diff line change @@ -113,14 +113,18 @@ def get_ydl_options(request_options):
113113 }
114114 )
115115
116- return {
116+ options = {
117117 "format" : ydl_vars ["YDL_FORMAT" ],
118118 "postprocessors" : postprocessors ,
119119 "outtmpl" : ydl_vars ["YDL_OUTPUT_TEMPLATE" ],
120120 "download_archive" : ydl_vars ["YDL_ARCHIVE_FILE" ],
121121 "updatetime" : ydl_vars ["YDL_UPDATE_TIME" ] == "True" ,
122122 }
123123
124+ if ydl_vars ["YDL_COOKIE_FILE" ]:
125+ options ["cookiefile" ] = f"/youtube-dl/{ ydl_vars ['YDL_COOKIE_FILE' ]} "
126+
127+ return options
124128
125129def download (url , request_options ):
126130 with YoutubeDL (get_ydl_options (request_options )) as ydl :
You can’t perform that action at this time.
0 commit comments