Use cookies when downloading - C0D3D3V/Moodle-DL GitHub Wiki

If you need a cookie to download various Moodle internal links, you can have one generated automatically. All you need to do is set download_also_with_cookie to true in the config.json. If this is enabled, a Cookies.txt file will be created which always contains a valid Moodle cookie for you.

If you would like to set a cookie for other sites you can extend this Cookies.txt or create your own.

The Cookies.txt file has the following scheme, it is very sensitive to wrong spaces:

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

school.moodledemo.net	FALSE	/	FALSE	2147483647	MoodleSession	2fe47f655acfb2fafcdbc790250cf631
.youtube.com	TRUE	/	FALSE	1608374433	PREF	f1=50000000&f6=8&hl=en
.youtube.com	TRUE	/	TRUE	1618742306	VISITOR_INFO1_LIVE	rSGqcM_O-uQ

If you set the expiration date to 2147483647 the cookie will only expire if the server deletes the cookie.

If you do not know how to create such a file, have a look here: https://github.com/ytdl-org/youtube-dl/blob/master/README.md#how-do-i-pass-cookies-to-youtube-dl