Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
marcoscale98 opened this issue Nov 5, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@marcoscale98
Copy link

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)
@marcoscale98 marcoscale98 added the bug Something isn't working label Nov 5, 2020
@C0D3D3V
Copy link
Owner

C0D3D3V commented Nov 5, 2020

Currently this is normal behavior of moodle-dl. Moodle-dl tries to download any external link using youtube-dl. You can't currently specify which links are not downloaded using youtube-dl. But you can specify which external links are downloaded at all, see here: https://github.com/C0D3D3V/Moodle-Downloader-2/wiki/Download-(external)-linked-files

The error is not that the link is downloaded :D Which is generally funny, the audio is downloaded from the login captcha... But the error is that youtube-dl could not create the file, why is still unclear to me. This is again one of the Windows problems.

@C0D3D3V
Copy link
Owner

C0D3D3V commented Nov 5, 2020

I guess the problem is that the file name is larger than 255 characters. I guess I have to change something about that.

@C0D3D3V
Copy link
Owner

C0D3D3V commented Nov 5, 2020

Yes thats it, according to the windows documentation:

The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters). To specify an extended-length path, use the "\?" prefix. For example, "\?\D:\very long path".

I will think about a possible fix ... for now you can also skip the failure with the --without-downloading-files flag, look at the readme for details.

@C0D3D3V C0D3D3V changed the title youtube-dl mistakenly tries to download a google calendar [Bug] Files with a file name that is longer than 255 characters cannot be downloaded. Nov 5, 2020
@C0D3D3V C0D3D3V changed the title [Bug] Files with a file name that is longer than 255 characters cannot be downloaded. [Windows][Bug] Files with a file name that is longer than 255 characters cannot be downloaded. Nov 5, 2020
@C0D3D3V C0D3D3V changed the title [Windows][Bug] Files with a file name that is longer than 255 characters cannot be downloaded. [Bug] Files with a file name that is longer than 255 characters cannot be downloaded. Feb 22, 2023
@C0D3D3V
Copy link
Owner

C0D3D3V commented Mar 1, 2023

Fix is released

@C0D3D3V C0D3D3V closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants