Example Config.json and Options - C0D3D3V/Moodle-DL GitHub Wiki

Example Config

Almost everything in the configuration can be changed, accompanied by a wizard.
All you have to do is run moodle-dl -c in the same folder as the configuration file.

  • To change the mail settings use moodle-dl -cm
  • To change the telegram settings use moodle-dl -ct
  • To generate a new token use moodle-dl -nt
  • To initiate the configuration use moodle-dl -i

A complete config.json can look like this:

{
    "token": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
    "privatetoken": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "moodle_domain": "moodle.ruhr-uni-bochum.de",
    "use_http": false,
    "moodle_path": "/m/",
    "download_path": "C:\PATH\TO\DOWNLOAD\LOCATION",
    "misc_files_path": "C:\PATH\TO\FILES_LIKE_moodle_state.db_and_Cookies.txt",
    "write_url_link": false,
    "write_webloc_link": false,
    "write_desktop_link": false,
    "write_link": true,
    "userid": 49408,
    "version": 2021051701,
    "telegram": {
        "token": "127123404:AAGc0KoobPAABBCgUgrUY5KiRMkUbn4vdE",
        "chat_id": "910011480",
        "send_error_msg": true
    },
    "discord": {
        "webhook_urls": [
            "https://discord.com/api/webhooks/CHANNEL/YOUR_TOKEN",
            "https://discord.com/api/webhooks/ANOTHER_CHANNEL/ANOTHER_TOKEN"
        ]
    },
    "sentry_dsn": "https://[email protected]/135128",
    "mail": {
        "sender": "[email protected]",
        "server_host": "smtp.provider.de",
        "server_port": "587",
        "username": "[email protected]",
        "password": "verysecurepassword",
        "target": "[email protected]",
        "send_error_msg": false
    },
    "download_course_ids": [
        25685,
        27288,
        23569
    ],
    "download_public_course_ids": [
        123,
    ],
    "options_of_courses": {
        "27288": {
            "original_name": "Netzsicherheit 2 (141243-SoSe20)",
            "overwrite_name_with": "NetzSec 2",
            "create_directory_structure": true
        },
        "23569": {
            "original_name": "Einf\u00fchrung in die Kryptographie (141022-WiSe19/20)",
            "overwrite_name_with": "EK 2",
            "create_directory_structure": true
        },
        "26528": {
            "original_name": "Deep Learning (150332-SoSe20)",
            "overwrite_name_with": "Deep Learning",
            "create_directory_structure": true
        },
        "26505": {
            "original_name": "Boolesche Funktionen mit Anwendungen in der Kryptographie (150357-SoSe20)",
            "overwrite_name_with": "BF",
            "create_directory_structure": true
        },
        "26398": {
            "original_name": "Quantenalgorithmen (150318-SoSe20)",
            "overwrite_name_with": "Quantenalgorithmen",
            "create_directory_structure": true
        },
        "25685": {
            "original_name": "Diskrete Mathematik II und Einf\u00fchrung in die theoretische Informatik (150310-SS 2020)",
            "overwrite_name_with": "Dima 2",
            "create_directory_structure": false
        }
    },
    "download_submissions": true,
    "download_descriptions": true,
    "download_links_in_descriptions": true,
    "download_linked_files": true,
    "download_also_with_cookie": true,
    "download_domains_whitelist": [
         "ruhr-uni-bochum.de",
         "sciebo.de",
         "rub.de"
    ],
    "download_domains_blacklist": [
         "youtube.com",
         "twitch.tv"
    ],
    "download_databases": true,
    "download_lessons": true,
    "download_forums": true,
    "download_quizzes": true,
    "download_workshops": true,
    "download_books": true,
    "download_calendars": true,
    "restricted_filenames": false,
    "youtube_dl_options": {
        "noplaylist": true
    },
    "exclude_file_extensions": [
        "png",
        "mkv"
    ],
    "max_file_size": 1000000,
    "videopasswords": {
        "ruhr-uni-bochum.sciebo.de": [
            "test",
            "password"
        ],
        "secret.service.fbi": "12345"
    },
    "external_file_downloaders" : {
        "bbb.rub.de" : "bbb-dl --add-webcam %U",
        "bbb-cluster.di.unito.it": "curl -L -O %U"
    }
}

Options documentation

The following snippet provides the above config file with comments for each option. Please note, that this commented snippet will not work, as JSON does not allow comments. If you need an example config to begin with, use the example config in the section above.

{
    "token": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", # authentication token
    "privatetoken": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", # authentication token
    "moodle_domain": "moodle.ruhr-uni-bochum.de", # the domain / url of your moodle server
    "use_http": false, # can be true or false. Specifies whether http or https is used
    "moodle_path": "/m/", # specifies the path / subdirectory of the url. 
    "download_path": "C:\PATH\TO\DOWNLOAD\LOCATION", # specifies the download path of the files on moodle itself
    "misc_files_path": "C:\PATH\TO\FILES_LIKE_moodle_state.db_and_Cookies.txt", # specifies the path for files of the moodle-downloader
    "write_url_link": false, # Windows Shortcut File
    "write_webloc_link": false, # MacOS Shortcut File
    "write_desktop_link": false, # Unix Shortcut File
    "write_link": true, # Write a shortcut file that matches your OS
    "userid": 49408, # on some moodle instances it is necessery to set the moodle version and user id manually, see https://github.com/C0D3D3V/Moodle-DL/wiki/Set-user-id-and-Moodle-version-number-manually
    "version": 2021051701, # see userid
    "telegram": { # information needed to connect a telegram bot
        "token": "127123404:AAGc0KoobPAABBCgUgrUY5KiRMkUbn4vdE",
        "chat_id": "910011480",
        "send_error_msg": true # can be true or false. Determines whether to send error messages via telegram
    },
    "discord": { # Webhook URLs for Discord (you could use other services if they use the same embeds data structure)
        "webhook_urls": [
            "https://discord.com/api/webhooks/CHANNEL/YOUR_TOKEN",
            "https://discord.com/api/webhooks/ANOTHER_CHANNEL/ANOTHER_TOKEN"
        ]
    },
    "sentry_dsn": "https://[email protected]/135128", # ?
    "mail": { # information needed to send emails
        "sender": "[email protected]",
        "server_host": "smtp.provider.de",
        "server_port": "587",
        "username": "[email protected]",
        "password": "verysecurepassword",
        "target": "[email protected]",
        "send_error_msg": false # can be true or false. Determines whether to send error messages via email
    },
    "download_course_ids": [ # course ids to be downloaded
        25685,
        27288,
        23569
    ],
    "download_public_course_ids": [ # ?
        123,
    ],
    "options_of_courses": { # further options for the courses that are downloaded. 
        "27288": {
            "original_name": "Netzsicherheit 2 (141243-SoSe20)", # original name of the course. This is optional
            "overwrite_name_with": "NetzSec 2", # folder name of the downloaded course
            "create_directory_structure": true # can be true or false. Determines whether to create subfolders within the folder of a course.
        },
        "23569": {
            "original_name": "Einf\u00fchrung in die Kryptographie (141022-WiSe19/20)",
            "overwrite_name_with": "EK 2",
            "create_directory_structure": true
        },
        "26528": {
            "original_name": "Deep Learning (150332-SoSe20)",
            "overwrite_name_with": "Deep Learning",
            "create_directory_structure": true
        },
        "26505": {
            "original_name": "Boolesche Funktionen mit Anwendungen in der Kryptographie (150357-SoSe20)",
            "overwrite_name_with": "BF",
            "create_directory_structure": true
        },
        "26398": {
            "original_name": "Quantenalgorithmen (150318-SoSe20)",
            "overwrite_name_with": "Quantenalgorithmen",
            "create_directory_structure": true
        },
        "25685": {
            "original_name": "Diskrete Mathematik II und Einf\u00fchrung in die theoretische Informatik (150310-SS 2020)",
            "overwrite_name_with": "Dima 2",
            "create_directory_structure": false
        }
    },
    "download_submissions": true, # can be true or false. Determines whether submissions are being downloaded.
    "download_descriptions": true, # can be true or false. Determines whether descriptions of moodle sections are being downloaded.
    "download_links_in_descriptions": true, # can be true or false. Determines whether links in the descriptions of moodle sections are being downloaded.
    "download_linked_files": true, # can be true or false. If there is a link to an external file, this option determines whether this file is downloaded.
    "download_also_with_cookie": true, # ?
    "download_domains_whitelist": [ # if "download_linked_files" is _true_, this options allows for specifying which domains to whitelist 
         "ruhr-uni-bochum.de",
         "sciebo.de",
         "rub.de"
    ],
    "download_domains_blacklist": [ # if "download_linked_files" is 'true', this options allows for specifying which domains to blacklist
         "youtube.com",
         "twitch.tv"
    ],
    "download_databases": true,  # can be true or false. Determines whether databases are being downloaded. 
    "download_lessons": true,
    "download_forums": true,
    "download_quizzes": true,
    "download_workshops": true,
    "download_books": true,
    "download_calendars": true,
    "restricted_filenames": false, # ?
    "youtube_dl_options": { # further options for the YouTube downloader. 
        "noplaylist": true # can be true or false. If a link points to a YouTube playlist, this option determines whether to download the whole playlist. 
    },
    "exclude_file_extensions": [ # specifies which files to be not downloaded by the moodle downloader
        "png",
        "mkv"
    ],
    "max_file_size": 1000000, # max size in bytes of a internal moodle file, that should be downloaded and notified about. Files that are bigger than that, are ignored. (example is 1mb) This does not affect external files.
    "videopasswords": { # ?
        "ruhr-uni-bochum.sciebo.de": [
            "test",
            "password"
        ],
        "secret.service.fbi": "12345"
    },
    "external_file_downloaders" : { # for a given domain, you can specify a cmd / shell command here that is executed if the moodle downloader encounters this domain. %U is a placeholder for the url which the moodle downloader will inject accordingly. 
        "bbb.rub.de" : "bbb-dl --add-webcam %U",
        "bbb-cluster.di.unito.it": "curl -L -O %U"
    }
}
⚠️ **GitHub.com Fallback** ⚠️