Skip to content
Snippets Groups Projects
Select Git revision
  • main default protected
1 result

codimd-export-script

  • Clone with SSH
  • Clone with HTTPS
  • CodiMD note exporter

    This little tool is intended to help you backup the notes that you have in your CodiMD history to a local folder. It complements CodiMD's "export user data" functionality, which only downloads documents that you own.

    Requirements

    Its only dependency is Python >= 3.7 (use python3 -V to check your version).

    Usage

    1. Extract value of the session cookie

    First of all, you need to extract the value of the connect.sid browser cookie for the particular CodiMD instance that you use (e.g., md.inf.tu-dresden.de).

    This procedure is necessary because the CodiMD login is handled externally by Keycloak.

    WARNING: the value of the cookie is your session ID and as such, should be treated like a password. Don't share it with others!

    Now, the instructions are similar for Chrome and Firefox:

    1. Navigate your browser to the CodiMD instance.
    2. Open developer tools.
    3. Chrome: go to the "Application" tab. Firefox: go to the "Storage" tab ("Web-Speicher").
    4. Un-collapse "Cookies".
    5. In the list, search for a cookie with the name connect.sid
    6. Select and copy the value. It must start with the character sequence s%3A.

    2. Execute the script via the command line

    Clone this repository to a path of your liking and just execute ./codimd_export.py in a shell. The script will ask for your session id and download the notes to the relative path ./codimd-documents.

    Please note that your CodiMD history might reference already deleted notes or notes you no longer have access to. The URLs of these inaccessible notes are listed as part of the script's output.

    Example

    $️ ./codimd_export.py
    Please provide your CodiMD session id (connect.sid cookie):
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/TOPofLSB
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/6jeKGnJnSp6H0f0mVnBwQQ
    HTTP 403 Forbidden: https://md.inf.tu-dresden.de/klausur-2020-experiences
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/iQVB7TO-QXqi3hGSZ7J4Eg
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/LSB-2020-11-17
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/Nzbj13ydRLe1d0fRCyG6cA
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/LSB-2021-02-02
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/LSB-2021-06-22
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/LSB-2021-12-07
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/ThesisTemplateBachelor
    HTTP 404 Not Found: https://md.inf.tu-dresden.de/cnoGl7hoTaK1JIh2-u-h0g
    Done: 163 notes successfully downloaded, 11 not accessible.