Giter Club home page Giter Club logo

moodle-dl's Introduction


Moodle-DL

Because manually downloading all the course files every few days is just way too easy inefficient.
Built with ❀︎

moodle-dl is a console application that can download all the files from your Moodle courses that are necessary for your daily study routine. Furthermore, moodle-dl can notify you about various activities on your Moodle server. Notifications can be sent to Telegram, Discord, XMPP and Mail. The current implementation includes:

  • Download files, assignments including submissions, books, calendar events, forums, workshops, lessons, quizzes, descriptions, as well as external links (OpenCast, Youtube, Sciebo, Owncloud, Kaltura, Helixmedia, Google drive,... videos/files).
  • Notifications about all downloaded files
  • Text from your Moodle courses (like pages, descriptions or forum posts) will be directly attached to the notifications, so you can read them directly in your messaging app.
  • A configuration wizard is also included, allowing all settings to be made very easily.
  • Running moodle-dl again will only download files that have not been downloaded yet. Do not miss any files, if files are deleted online, they are still available offline.
  • It is possible to download Moodle courses you are enrolled in, as well as courses that are publicly visible to you.

Discussions about the development take place mainly on Github, but also on Discord.

πŸš€ Setup

Deploy with Docker latest packaged version(s) Packaging status Discord Shield

  1. Install Python >=3.7
  2. Install ffmpeg
  3. Run pip install moodle-dl as administrator.
    (To upgrade from an older Version use pip install -U moodle-dl instead)
  4. [Windows only]
If step 3 failed, you may need to do additional steps. Click here to see the additional Instructions

You may need to install Visual C++ compiler for Python to build all the dependencies successfully:

If you run the program on Windows, please use Powershell or CMD. Please do not use a mintty like MINGW or similar.

  1. Run moodle-dl --help to see all available options.

Usage

Moodle-dl uses the Moodle mobile API. If your Moodle does not allow access via the Moodle app, Moodle-dl will not be able to connect to your Moodle.

If you don't want moodle-dl to use the current working directory, then you should set the --path option on all commands.

  • moodle-dl --init

    • Create an initial configuration. A CLI configuration wizard will lead you through the initial configuration.
    • If you have to log in with Single Sign On (SSO, something like Shibboleth or OAuth2), you can set the option --sso additionally.
    • If at any point in time, the saved token gets rejected by Moodle use moodle-dl --new-token instead
    • To automate the login you can use the additional options --username and --password or --token.
  • moodle-dl

    • After configuring moodle-dl, this command is sufficient to download all files from your Moodle account and notify you about the result.
  • moodle-dl --config

    • A CLI configuration wizard will lead you through the additional configuration of moodle-dl.
    • You can start the wizard after the initial configuration if you want to change any of the settings.
    • The wizard allows you to change nearly all settings of moodle-dl
      • select the courses that will be downloaded
      • rename each course individually
      • decide if subfolders should be created inside a course folder
      • set whether submissions (files uploaded to assignments by yourself or a teacher), descriptions, links inside descriptions, databases, quizzes, lessons, workshops and forum discussions should be downloaded
      • set if external files should be downloaded (files like Youtube videos)
      • set if files on moodle that require a cookie should be downloaded
      • to add extra courses to your download list which you can see but you are not enrolled in, check out this wiki entry
    • Not all moodle-dl settings are available in the CLI configuration wizard for configuration, see the wiki for more available options.

By default a private token is stored in the initial configuration, this is only needed for special Moodle modules that cannot be queried via the Moodle API. If no such module is available in your Moodle you are welcome to delete this token.

If you need help configuring telegram notifications click here

Notes

  • Use a separate E-Mail/XMPP - Account for sending out the notifications, as its login data is saved in cleartext.
  • The Login-Information for your Moodle-Account is secure, it isn't saved in any way. Only a Login-Token is saved.
  • Your Moodle token is stored in the configuration file (config.json). Be careful that no unauthorized person reads this file, especially the token must not be given to an unauthorized person, this can cause a lot of trouble.
  • The privatetoken can be used to create a cookie for your Moodle account. A Cookie is what is used to tell Moodle that you are logged in. The cookie.txt always keeps a valid cookie for you, take great care of this file, if it falls into the wrong hands someone can take over your entire Moodle account. This feature is only important for Moodles with plugins installed that are not supported by the Moodle app. If you do not want to generate cookies, remove the privatetoken from the config.json.

Alternativ downloader

webeep-sync

  • Written with node.js
  • Has a nice GUI that allows you to sync your courses easily
  • Is only built for the moodle of the Polytechnic University of Milan

syncMyMoodle

  • Has pretty much the same goals as moodle-dl
  • Is only built for the moodle of the Rhenish-Westphalian Technical University (RWTH) Aachen

edu-sync

  • Is built in Rust and therefore quite fast

tum-moodle-downloader

  • Uses a web scraper instead of the moodle mobile API
  • It has some interesting commands implemented to download only specific content
  • Is only built for the moodle of the Munich University of Technology (TUM)

moodle-buddy

  • Plugin for Firefox and Chrome
  • Mass file download and notification functionality for the Moodle

moodle-downloader

  • A chrome extension for batch downloading Moodle resources

Orga Bot

  • Utilizes moodle-dl to send moodle files via Discord

discord-moodle-bot

  • Discord Notification Service for your moodle courses

If someone wants to link another downloader here, which offers e.g. functions that moodle-dl does not offer, feel free to open an issue.


πŸ† Contributing

You would like to become a maintainer of this project? Then contact me!

Do you have a great new feature idea or just want to be part of the project? Awesome! Every contribution is welcome! If you want to find out more about how to contribute to the project, please check out our CONTRIBUTING.md!

βš–οΈ License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details

moodle-dl's People

Contributors

alexbocken avatar azuxul avatar batuhanfaik avatar c0d3d3v avatar dan-hanlon avatar daniarla avatar frereit avatar fulachs avatar jackorse avatar jacotsu avatar jnnkb avatar jogerj avatar jonas-t-s avatar lavgup avatar leo872016 avatar mrkriskrisu avatar ndarr avatar omasakun avatar p-fruck avatar rar0ch avatar roeekl avatar shoeper avatar stefa168 avatar varchar42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

moodle-dl's Issues

Is my Moodle not supported?

Avoid duplicates

  • [ x ] This enhancement request has not already been raised before

Is your feature request related to a problem? Please describe.

My university is using moodle with SSO however, they don't have the moodle downloader plugin enabled meaning I cannot perform the automatic or manual SSO sign in methods.

Describe the solution you'd like

Would be fantastic if there was another method of getting the token.

Describe alternatives you've considered

I haven't analyzed how SSO works, so I can't help here.

[Request] Also download submissions

I have a couple of systems running the script and the only inconvenience i faced is that if i want to go back to the work that I hve made I have to manually download the files that i want.

Also it would be nice for example, to get to the end of a course, run the script and have an offline copy of all the work you have done, as well as all the files in case the page ever gets removed.

Error while trying to load the Configuration (Win10)

I have an Error when I want to change the path.
The Moodle Downloader (all files, also config) is in D:\Uni\Moodle\Moodle-Downloader-2-master.
I want to set the path to Moodle typing python D:\Uni\Moodle\Moodle-Downloader-2-master\main.py --path D:\Uni\Moodle\. (Powershell)
Then he obviously has problems to find the config. Where is my fault?

Token error

What is this error?

Moodle Downloader starting... Loading config... Checking for changes for the configured Moodle-Account... Download account informationException: Traceback (most recent call last): File "D:\Marco\Universita\Moodle-Downloader-2\moodle_connector\moodle_service. py", line 160, in fetch_state userid, version = results_handler.fetch_userid_and_version() File "D:\Marco\Universita\Moodle-Downloader-2\moodle_connector\results_handler .py", line 30, in fetch_userid_and_version result = self.request_helper.post_REST('core_webservice_get_site_info') File "D:\Marco\Universita\Moodle-Downloader-2\moodle_connector\request_helper. py", line 65, in post_REST return self._initial_parse(response) File "D:\Marco\Universita\Moodle-Downloader-2\moodle_connector\request_helper. py", line 207, in _initial_parse exception, errorcode, message moodle_connector.request_helper.RequestRejectedError: The Moodle System rejected the Request. Details: moodle_exception (Errorcode: invalidtoken, Message: Token non valido - il token non β–’ stato trovato) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "main.py", line 208, in run_main changed_courses = moodle.fetch_state() File "D:\Marco\Universita\Moodle-Downloader-2\moodle_connector\moodle_service. py", line 213, in fetch_state error)) RuntimeError: Error while communicating with the Moodle System! (The Moodle Syst em rejected the Request. Details: moodle_exception (Errorcode: invalidtoken, Mes sage: Token non valido - il token non β–’ stato trovato)) The following error occurred during execution: Error while communicating with th e Moodle System! (The Moodle System rejected the Request. Details: moodle_except ion (Errorcode: invalidtoken, Message: Token non valido - il token non β–’ stato t rovato))

[Feature Request] Add support for `lesson` and `workshop` module

Avoid duplicates

  • Bug is not already reported in another issue

Describe the bug

Php files are not being downloaded, only the md files even though external files are selected.

2020-09-14 22:31:44  DEBUG  {results_handler}  Detected moodle version: 2019111803
2020-09-14 22:31:46  WARNING  {cookie_handler}  Moodle cookie has expired, an attempt is made to generate a new cookie.
2020-09-14 22:31:53  DEBUG  {moodle_service}  Checking for changes...
2020-09-14 22:31:53  DEBUG  {main}  Start downloading changed files...
2020-09-14 22:31:57  ERROR  {download_service}  Error while trying to download file: URLTarget (File (module_id: 7377770, section_name: Week 1, module_name: Assignment 3: Assessm..., content_filepath: /, content_filename: h
ttps://moodleaddress.com/mod/workshop/view.php?id=12345, content_fileurl:h
ttps://moodleaddress.com/mod/workshop/view.php?id=12345, content_filesize: 0, content_timemodified: 0, module_modname: cookie_mod, content_isexternalfile: True, saved_to: class1/Week 1 - assignments /httpsκž‰οΌοΌmoodleaddress.com/mod/workshop/view.php?id=12345, time_stamp: 0, modified: False, moved: False, deleted: False, notified: False, hash: None), False, None)

[Enhancement] Consider removal of downloaded files in database

If you remove files, which you don't need (anymore) or by accident, the database could reflect this state.

If you want to download those files again, you can do so easily (without manually modifying the database).

You could argue that if you don't want to the keep those files at all, hence you don't want to download them, they will be downloaded anyways if the database tracks removed files. But then again I don't think this is a sensible use case.

On the latest build, additional configurations makes the program crash

immagine

After the crash, running again the program makes it break.

How to reproduce: configure a new account on a fresh install, then, when the terminal asks you "Do you want to make additional configurations now?" press the arrow down to go to no.

Reproduction rate: 100% every time i configure a new account on a fresh install.

way to download deleted folder

Is there any way to download accidentally deleted course folder without downloading everything else (or new configuration).
$ python3 main.py
doesn't support it.

[Feature Request] Download files inside sub-structures (databases).

Hello!

I'm enrolled in a course where the excercises are not uploaded directly into a structure (https://the_domain/moodle/course/view.php?id=3588) but in a sub-structure (https://the_domain/moodle/mod/data/view.php?id=169908) as it can be seen in the following image:

image

Said that, when configuration is done and executed, it doesn't download the sub-structure where files are located.
Is it possible to add that feature? It will be much appreciated!

This package is now available on the AUR!

Hello! I am an Arch Linux user that really enjoyed using this package. We have the AUR (Arch Linux User Repository), with lots of lesser known packages and unofficial to the distro. It's relatively easy to upload one in there, so I wrote a PKBUILD and uploaded it as moodle-dl-git.

I decided to install it directly from this source (hence the -git suffix) instead of the releases page because there seem to be lots of releases and I don't have enough time to fully maintain it. I assumed that the master branch is more or less stable, though.

I just wanted to let the maintainers know about this. If you want to modify anything in the package I uploaded, do let me know. I can also add you as co-maintainers if you use this distro as well and are interested in helping out.

I partly opened this issue so that this can be added to the README for future Arch users, which prefer using the AUR than pip to install packages. Not sure if other distros have this program uploaded to their repositories, but it could be a new section in the "Installation" part.

[Feature Request] Download discussion forums

Avoid duplicates

  • This enhancement request has not already been raised before

Is your feature request related to a problem? Please describe.

Discussion forums does not seem to be downloaded. Good to have grades downloaded too.

Describe the solution you'd like

Archive discussion forums as well, possibly either using MarkDown or HTML.

Describe alternatives you've considered

Additional context

Generate a new token inline

Would be great for automated systems to have the command moodle-dl --new-token username password instead of being a triple step command, so my server can re-generate the token when it's not working anymore.

Different Sizes of Data on Windows vs Ubuntu

Hi,

Thanks for your time and effort to build this software; it is a well designed piece of software. :-)

However, i think i found an issue regarding OS-Support.
I first tried to use the tool on Windows, and loaded the entire moodle of my university. (Courses i currently attend or attended in the past) and found some files missing, but are present in the browser.

I could not explain myself exactly why, because there were no errors in the console and some characters like ">" transferred to ")" so I've seen characters not supported in NTFS are taken care of.

After that, I tried the tool on Ubuntu with the same settings, and now it is working. No files missing.

Windows: 2,32 GB (624 Files, 190 Folders)
Ubuntu: 2,70 GB (707 Files, 203 Folders)

(I zip'ed the ubuntu files and extracted them to my windows-machine)

Maybe you can think of an explanation.

Regards
Blaubeere

"python3 main.py --init" does nothing

image
The command does not give any other messages or settings or anything, at all.

All dependencies are satisfied, using python 3.8 (could this be the problem?) on windows 10

[Bug] Files with a file name that is longer than 255 characters cannot be downloaded.

i was doing my usual
moodle-dl
when i found youtube-dl error

This is the file log:

2020-11-05 08:31:25  ERROR  {url_target}  T2 - youtube-dl Error: ERROR: unable to open for writing: [Errno 22] Invalid argument: '\\\\?\\H:\\moodle\\Modelli e architetture avanzati di basi di dati, aa 2019_2020\\Introduzione\\Calendario del corso (con suddivisione tra le docenti) # Google Calendar - Accedi per visualizzare e modificare i tuoi impegni (calendarcid=MDViYXBvYXQ3ZmJwcTc4NHNtM2s2dmoybGtAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&btmpl=mobile&ltmpl=mobileh&scc=1).unknown_video.part'
2020-11-05 08:31:25  ERROR  {url_target}  T2 - Error while trying to download file: URLTarget (File (module_id: 121843, section_name: "Introduzione", module_name: "Calendario del corso (con suddivisione tra le docenti)", content_filepath: /, content_filename: "Calendario del corso (con suddivisione tra le docenti)", content_fileurl: "https://calendar.google.com/calendar?cid=MDViYXBvYXQ3ZmJwcTc4NHNtM2s2dmoybGtAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ", content_filesize: 0, content_timemodified: 1551029281, module_modname: url, content_type: url, content_isexternalfile: False, saved_to: "\\?\H:\moodle\Modelli e architetture avanzati di basi di dati, aa 2019_2020\Introduzione\Calendario del corso (con suddivisione tra le docenti).URL", time_stamp: 1604561482, modified: False, moved: False, deleted: False, notified: False, hash: None, file_id: None, old_file_id: None), Course (id: 1947, fullname: "Modelli e architetture avanzati di basi di dati, aa 2019_2020", overwrite_name_with: "None", create_directory_structure: True, files: 1), False, Error: Traceback (most recent call last):
File "C:\Users\marco\AppData\Roaming\Python\Python37\site-packages\moodle_dl\download_service\url_target.py", line 719, in download
    self.try_download_link(add_token, False, False)
  File "C:\Users\marco\AppData\Roaming\Python\Python37\site-packages\moodle_dl\download_service\url_target.py", line 476, in try_download_link
'Youtube-dl could not download the URL. For details see youtube-dl error messages in the log file'
RuntimeError: Youtube-dl could not download the URL. For details see youtube-dl error messages in the log file
Error:Youtube-dl could not download the URL. For details see youtube-dl error messages in the log file)

deleted files (documentation)

What happens when files where deleted on moodle?

Here an extract from the last run:

Public Key Infrastrukturen 2019
-	/files/Public Key Infrastrukturen 2019/Allgemeines/Klausur_Deckblatt.pdf
-	/files/Public Key Infrastrukturen 2019/Allgemeines/Task3Solved.pdf
[..]

Fortunately it looks like the files were not deleted (I think downloaded files should never be deleted). So, am I right that this only reflects a database change?

Download BigBlueButton lessons

Avoid duplicates

  • [βœ”οΈ] This enhancement request has not already been raised before

Feature Request

I'd like the downloader to download BigBlueButton (an open-source webconferencing suite) lessons.
Usually lessons are grouped like the image below:

immagine

And redirect to a link like https://SITEWITHMOODLE/mod/bigbluebuttonbn/view.php?id=143127#

Solution?

The main issue with BBB is that there is more than 1 recordings when it comes to lessons. Usually professors record themselves with a cam and a presentation PDF sliding. Being only the webcam a downloadable video, I find this very hard to implement this enhancement, but I'm proposing y'all.

immagine

As you can see (i removed the professor webcam on the right, but you can imagine), there is a playback control, but it's not related to a video, rather than a complicated presentation slider + webcam video as I previously said.

naming problems in file structure with special characters

I don't know the exact cases when it happens but if a moodle section or course has special characters like "/" or ":" it always uses some kind of ID for the folder.
It names it "XXXXXX~X" in alphanumerical chars with the same length.
Is it perhaps possible to parse out these special characters and just name the folder without them?
"Example course 1/2" to "Example course 1 2" instead of "XXXXXX~X"

Edit: just read the documentation again and yes you can rename the course name but as far as i see you can't rename the sections in the course. I think it would be easier for most people to just let it automatically rename the folder instead of doing it manually since the meaning should be clear even if the special character is missing.

Download videos/files from particular websites like Zoom automatically

Some professors post video links of zoom, universityspecificyoutube etc on moodle. Often these links require authorization, which can be handled by --cookies option in youtube-dl or --load-cookies option in wget.
Is there a way to automatically force download these links posted on moodle.
User can specify pattern of the links and software to use for them, something like,
dropbox -> wget
youtube -> youtube-dl
zoom -> wget
universityspecificyoutube -> youtube-dl
PS: the cookies can be set using https://github.com/dandv/convert-chrome-cookies-to-netscape-format

Example configuration for SSO

Hi, could you check in an example configuration?

I'd like to use the tool but our university uses SSO. Maybe it is possible to obtain the token externally and pass it using the config. It would be helpful to have a template configuration, so one doesn't have to look up configurable options in the code.

UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3'

Hey, I came across a UnicodeEncodeError while using Moodle_Downloader_2.

Start downloading changed files...
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/app/moodle_downloader_2/download_service/downloader.py", line 61, in run
    self.state_recorder.save_file(
  File "/app/moodle_downloader_2/state_recorder/state_recorder.py", line 335, in save_file
    self.new_file(file, course_id, course_fullname)
  File "/app/moodle_downloader_2/state_recorder/state_recorder.py", line 346, in new_file
    cursor.execute("""INSERT INTO files
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 11: surrogates not allowed

No matching distribution found for requirements.txt

Im using Manjaro, and im getting a couple of errors:

$ pip3 install -r requirements.txt
Collecting sentry_sdk>=0.13.5 (from -r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/ba/0b/ba1655f0e9c248538b02322a979b5cd485156f5cc16ea34a3cff563527ee/sentry_sdk-0.14.0-py2.py3-none-any.whl (93kB) |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 102kB 2.7MB/s Requirement already satisfied: urllib3>=1.10.0 in /usr/lib/python3.8/site-packages (from sentry_sdk>=0.13.5->-r requirements.txt (line 1)) (1.25.7) Collecting certifi (from sentry_sdk>=0.13.5->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB) |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 163kB 3.5MB/s Installing collected packages: certifi, sentry-sdk ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python3.8/site-packages/certifi-2019.11.28.dist-info' Consider using the --user` option or check the permissions.

$ pip3 install --user requirements.txt

Collecting requirements.txt ERROR: Could not find a version that satisfies the requirement requirements.txt (from versions: none) ERROR: No matching distribution found for requirements.txt

Readline not a module

I have followed the instructions to run this on Python 3.8, and it just doesn't work.

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    import readline
ModuleNotFoundError: No module named 'readline'

it doesn't download all the videos on the page

Look at this example:
foto1
This is the section of a course. Each link leads to a moodle page where there are several videos and comments.
foto3
But the program downloads only the first video as you can see in the next photo.
foto2

Issue obtaining SSO Token

Hey,
I have issues obtaining the SSO Token as when i try to initialize with --init --sso i get through up to the part where i have to copy the page that didnt load. I dont get any not loading pages in my developer network window. I just get two 404s with one being the weppage itself and one being a background image. Every other request is ok(200). All I get from the network tool is a sess key. But i dont know what type of input the script expects? Can someone help me obtaining the SSO Token manually and get it to initialize?

Moodle Version is 3.83
It would also immensely help if someone knows the url its expecting there.

Thank you.

[Feature Request] video and documents crawler and scraper

@C0D3D3V Glad that you are planning to add video downloads in the next few weeks.

Usually most of the mooc courses running moodle tend to store and link documents and videos to third party providers like youtube, tube.switch, vzaar among others.

I feel like it would be nice to crawl and scrap those videos from this script itself with indexing so that the videos and documents from third parties are not scattered and unindexed in case of downloading from third party tools like youtube-dl and video-downloader.

Just my two cents.

Cheers,
/z

Exception: 's'

Looking at the logs I'm getting error in a lot of files:
2020-01-15 10:15:13 ERROR {download_service} Error while trying to download file: [COURSE] -[File.pdf]! Exception: 's'

Not sure why.
Also a option for saving the files in a specific location and not in the same folder as all the files would be awesome so I can have my files organized.

sso login

For me the automated sso login does not work for one moodle. It does work for another moodle.

SSO url: https://moodle.informatik.tu-darmstadt.de/admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=12345&urlscheme=http%3A%2F%2Flocalhost

error/Invalid parameter: the value of urlscheme isn't valid. It should start with a letter and can only contain letters, numbers and the characters "." "+" "-".

Screenshot from 2020-03-24 13-42-35

It works for another moodle where the url is https://moodle.tu-darmstadt.de/admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=12345&urlscheme=http%3A%2F%2Flocalhost

Didn't find the version of the moodles so far and from a quick search it looks like they're trying to hide it.

/moodle\\login/token.php was not found on the server

Hi everyone, when I set up the moodle account i receive this errors:
Error while communicating with the Moodle System! (An Unexpected Error happened on side of the Moodle System! Status-Code: 404 Header: [('Date', 'Wed, 19 Feb 2020 10:01:18 GMT'), ('Server', 'Apache/2.4.7 (Ubuntu)'), ('Content-Length', '304'), ('Content-Type', 'text/html; charset=iso-8859-1')] Response: b'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /moodle\\login/token.php was not found on this server.</p>\n<hr>\n<address>Apache/2.4.7 (Ubuntu) Server at elearning.unisi.it Port 443</address>\n</body></html>\n') Please try again.

but as you can see the token.php page is on the server: https://elearning.unisi.it/moodle/login/token.php and in https://elearning.unisi.it/moodle//login/token.php

What can i do? can i manually extract the token and pass it to the software?
Thanks in advance!

ConnectionRefusedError: [WinError 10061]

I am using WIn10 and got the problem sretting up the config via main.py --init
I typed in URL (in my case moodle.rub.de), the username, the password. After a few seconds I get the Error of the topic. In addition it says the Destination Computer refuses the connection establishment.
Is there any solution or am I doing something wrong? I also checked my Firewall and tried to execute it with deactivated firewall...

Thanks for help!

Git like feature in course download folder

It is continuation of issue #43. It more makes sense to use the git approach for folder version management in downloaded course folder.
It will automatically add features to solve the issue of accidental file/folder deletion.
May be it is better that if each course can be treated independently, for e.g.,

$ python3 main.py --pull "$(courseid)" # will update the course content for id $(courseid)
$ python3 main.py --status "$(courseid)" # show status as git status
$ python3 main.py --checkout $(courseid) $(logid) # restore to old log id like git checkout
$ python3 main.py --rm $(some_individual_file) # like git rm

Video mp4 download

It would be nice to introduce the possibility of downloading videos in mp4 format. Currently the system only produces a link which, once opened, downloads the video. Maybe you could choose it during configuration

Some description files make the download process halt indefinitely

After fixing the UTF-8 encoding issue, I tried re-starting the download process.
After some time downloading part of the files, it halts after throwing this error:

Moodle Downloader starting...
Loading config...
Checking for changes for the configured Moodle-Account...
Download course information   1/  1 [Linguaggi e Par..|  1771]
Start downloading changed files...
Total:  31%        17375/       54549kb T0:  97% T1:   0% T2:   0% T3:   0% T4:Exception in thread Thread-4:
Traceback (most recent call last):
  File "C:\Users\myuser\PycharmProjects\Moodle-Downloader-2\download_service\url_target.py", line 205, in download
    self.create_description()
  File "C:\Users\myuser\PycharmProjects\Moodle-Downloader-2\download_service\url_target.py", line 167, in create_description
    self.file.saved_to = self._rename_if_exists(self.file.saved_to)
  File "C:\Users\myuser\PycharmProjects\Moodle-Downloader-2\download_service\url_target.py", line 121, in _rename_if_exists
    Path(new_path).touch()
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python37-32\lib\pathlib.py", line 1220, in touch
    fd = self._raw_open(flags, mode)
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python37-32\lib\pathlib.py", line 1028, in _raw_open
    return self._accessor.open(self, flags, mode)
OSError: [Errno 22] Invalid argument: "Linguaggi e Paradigmi di Programmazione 2019\\7 ottobre - 13 ottobre\\Teoria\r\nFare riferimento all'articolo di Hudak (19.md"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\Users\myuser\PycharmProjects\Moodle-Downloader-2\download_service\downloader.py", line 41, in run
    response = url_target.download(self.thread_id)
  File "C:\Users\myuser\PycharmProjects\Moodle-Downloader-2\download_service\url_target.py", line 231, in download
    os.path.getsize(self.file.saved_to) == 0):
  File "C:\Users\myuser\AppData\Local\Programs\Python\Python37-32\lib\genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
OSError: [WinError 123] La sintassi del nome del file, della directory o del volume non Γ¨ corretta: "Linguaggi e Paradigmi di Programmazione 2019\\7 ottobre - 13 ottobre\\Teoria\r\nFare riferimento all'articolo di Hudak (19.md"

Total:  32%        17670/       54549kb T0:   0% T1:   0% T2:   0% T3:   0% T4:
Process finished with exit code -1 <---- Here I manually stopped the program

This is the HTML of the description section that causes the problem.

I believe it is caused by newlines in the path ("Teoria\r\nFare riferimento all'articolo di Hudak (19.md")

Syntax Error: main.py line 239 (make sure the directory exists)

Hi,

I downloaded and installed the master branch with python 3.5.9 locally installed using asdf.

$ pip3 install -r requirements.txt --user
Collecting sentry_sdk>=0.13.5 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/8e/e6/058c2dc4723b3647a8cf61385c61f284bfbd0d0657bc5623c22e9ef45a3c/sentry_sdk-0.14.2-py2.py3-none-any.whl (96kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 102kB 775kB/s 
Collecting cutie>=0.2.2 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/79/1d/f8389619189b3de32f66be40cc7d17d6d2c06e35bbd21f6869120bd912b3/cutie-0.2.2-py3-none-any.whl
Collecting colorama>=0.4.3 (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
Collecting urllib3>=1.10.0 (from sentry_sdk>=0.13.5->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/e8/74/6e4f91745020f967d09332bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl (125kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 133kB 1.6MB/s 
Collecting certifi (from sentry_sdk>=0.13.5->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 163kB 1.8MB/s 
Collecting readchar (from cutie>=0.2.2->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ef/f3/50cc9199733bf91f3c140150752a6430d8b785f9d22a31dcae721edb0b9a/readchar-2.0.1-py3-none-any.whl
Installing collected packages: urllib3, certifi, sentry-sdk, readchar, colorama, cutie
Successfully installed certifi-2019.11.28 colorama-0.4.3 cutie-0.2.2 readchar-2.0.1 sentry-sdk-0.14.2 urllib3-1.25.8

So far so good, but:

$ python3 main.py --init
  File "main.py", line 238
    f"'{path}' is not a valid path. Make sure the directory exists.")
                                                                   ^
SyntaxError: invalid syntax

Which directory is it asking for? And which {path} is it referring to?

Cheers!
/z

[Feature Request] Insider content crawling

Most of the time content is not on the main page but on secondary pages: the only file saved will be a ".desktop" page, and not the content inside that page. More on screenshot.
immagine
(Gets the PDF but not the videos because they aren't directly in the main page)
immagine
(Clicking on the "video" will redirect on the page i really wanted to go for the download)

Can not acquire SSO token

Hey there, I am trying to login to moodle but even when I try manual or automatic sso token it never works. Can you please help?

Cannot download .pdf files

Wonderful tool you got there, thanks for it.
I can download videos hosted on you tube with the latest builds, but it simply skips .pdf (and zipped files, I guess...). Also, if I recall correctly, I did not have this problem in version 1.6.
Thanks for your time!

module 'urllib.parse' has no attribute '_splittype'

Running main.py throws this:

Error:module 'urllib.parse' has no attribute '_splittype'
xxx.pdf   Traceback (most recent call last):
  File "/mnt/c/xxx/md2/download_service/url_target.py", line 185, in download
    reporthook=self.add_progress)
  File "/mnt/c/xxx/md2/download_service/url_target.py", line 215, in urlretrieve
    url_type, path = urlparse._splittype(url)
AttributeError: module 'urllib.parse' has no attribute '_splittype'

Error:module 'urllib.parse' has no attribute '_splittype'

The log basically reads the same.
running Ubuntu 18.04.4 LTS on Windows Subsystem for Linux
Python3 3.6.9
Python 2.7.17

Any Ideas?

youtube-dl parsing issue

FYI - I'm running on Issue-41 build due to SSO / cookie issues.

I'm not receiving any other errors aside from the following youtube-dl excerpts. It does not show me the actual URL of where it is trying to go, but I know the youtube links in my lessons are public. I'm wondering if it is a parsing issue or something else. I'm running the latest version of youtube-dl from pip, on linux.

Thanks

Total: 0% 794/ 133314kb T0: 0% T1: 0% T2: 0% T3: 0% T4: 0%
youtube-dl: ERROR: unable to download video data: <urlopen error [Errno -2] Name or service not known>

youtube-dl: ERROR: unable to download video data: <urlopen error [Errno -2] Name or service not known>

Total: 0% 794/ 133314kb T0: 0% T1: 0% T2: 0% T3: 0% T4: 0%

Exception new version

I upgrade at the new version 2.1.0.1 and an exception was thrown.
Image deleted!
I don't have a cookies file

No module named 'electrum'?

I've tried to get the script to work, but I cannot find any module called "electrum". All Requirements are installed. Do you have further informations?

user@server:~/Moodle-Downloader-2# python3 main.py --init
Traceback (most recent call last):
File "main.py", line 15, in
from config_service.config_service import ConfigService
File "/user/Moodle-Downloader-2/config_service/config_service.py", line 4, in
from moodle_connector.results_handler import ResultsHandler
File "/user/Moodle-Downloader-2/moodle_connector/results_handler.py", line 5, in
from electrum.plugins.coldcard import description
ModuleNotFoundError: No module named 'electrum'

Error while communicating with the Moodle System!

python3 main.py --init
Do you want to activate Notifications via mail [y/n]?   n
Do you want to configure Error Reporting via Sentry? [y/n]n
[The following Credentials are not saved, it is only used temporarily to generate a login token.]
URL of Moodle:   https://moodle.bulme.at
Username for Moodle:   <username>
Password for Moodle [no output]:   
Error while communicating with the Moodle System! (An Unexpected Error happened on side of the Moodle System!) Please try again.

version (https://moodle.bulme.at/lib/upgrade.txt):

This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.

=== 3.7 ===
* Nodes in the navigation api can have labels for each group. See set/get_collectionlabel().
* The method core_user::is_real_user() now returns false for userid = 0 parameter
β€”β€”β€” ~ *snip* ~ β€”β€”β€”

EDIT: take a look at the title of the repo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.