Course contents - C0D3D3V/Moodle-DL GitHub Wiki

To get to the course content the function core_course_get_contents is used.

Area Name Introduced in Description
core_course core_course_get_contents 2.2 get course content (modules + web service file urls)

core_course_get_contents

Parameter
Funktion
Returns

A return can look as follows:

[
    {
        "id":323648,
        "name":"Allgemeines",
        "url":"https:\/\/moodle.uni.de\/m\/mod\/url\/view.php?id=949522", // on froum und url, but mostly only redirects to contents
        "visible":1,
        "summary":"",
        "summaryformat":1,
        "section":0,
        "hiddenbynumsections":0,
        "uservisible":true,
        "modules":[  
            {
                "id":949513,
                "name":"\n\n\nLiebe Studierende,\nwillkommen im Moodle-Kur...",
                "instance":109599,
                "description":"<div class=\"no-overflow\">HTML Description<\/div>",
                "visible":1,
                "uservisible":true,
                "visibleoncoursepage":1,
                "modicon":"https:\/\/moodle.uni.de\/m\/theme\/image.php\/boost_campus\/label\/1576236086\/icon",
                
                "modname":"label",      // Alternative: "forum", "url", "folder", "resource", "quiz"

                "modplural":"Textfelder",
                "indent":0,
                 "contents":[   // if "url" or "resource" or "folder"
	               { 
	                  "type":"url",
	                  "filename":"Webseite der Veranstaltung Netzsicherheit 1",
	                  "filepath":null,
	                  "filesize":0,
	                  "fileurl":"https:\/\/www.nds.uni.de\/teaching\/lectures\/664\/",		// the real url
	                  "timecreated":null,
	                  "timemodified":1411680382,
	                  "sortorder":null,
	                  "userid":null,
	                  "author":null,
	                  "license":null
	               },
	               { 
	                  "type":"file",
	                  "filename":"01_Grundlagen.pdf",
	                  "filepath":"\/",
	                  "filesize":3809147,
	                  "fileurl":"https:\/\/moodle.uni.de\/m\/webservice\/pluginfile.php\/1452961\/mod_resource\/content\/4\/01_Grundlagen.pdf?forcedownload=1",
	                  "timecreated":1571408009,
	                  "timemodified":1571408019,
	                  "sortorder":1,
	                  "mimetype":"application\/pdf",
	                  "isexternalfile":false,
	                  "userid":25394,
	                  "author":"Some Dude",
	                  "license":"allrightsreserved"
	               }
	               // contents
	             ]
            },
            {  // assign
               "id":1002989,
               "url":"https:\/\/moodle.uni.de\/m\/mod\/assign\/view.php?id=1002989",
               "name":"Dateiabgabe: Aufgabe 3",
               "instance":20670,
               "visible":1,
               "uservisible":true,
               "visibleoncoursepage":1,
               "modicon":"https:\/\/moodle.uni.de\/m\/theme\/image.php\/boost_campus\/assign\/1576236086\/icon",
               "modname":"assign",
               "modplural":"Aufgaben",
               "indent":1
            },...
            // Modules
        ]
    },
    //Sections
]

Files can now be downloaded by taking the URL from the fileurl parameter and appending the token to the URL. These are special URLs which can be reached with the help of the token without login.

⚠️ **GitHub.com Fallback** ⚠️