AlexCSDev / PatreonDownloader

Powerful tool for downloading content posted by creators on patreon.com. Supports content hosted on patreon itself as well as external sites (additional plugins might be required).
MIT License
917 stars 95 forks source link

ERROR Failed to download - Could not find part of the path, System Exception. #211

Open bahdahbadha opened 8 months ago

bahdahbadha commented 8 months ago

Downloading fails because the path to the downloaded file is unable to be found? Below I write the entire error message for a single file (while also taking out possible personal data).

2023-12-17 18:07:12.9775 INFO Downloading... 2023-12-17 18:07:13.7679 ERROR Failed to download [LINK]: Error while downloading [LINK]: Unable to download from [LINK]: Could not find a part of the path 'C:\net6.0-win-x64-release\download[PATREON] \64669643_media_147675729_1.jpg.dwnldtmp'.. Inner Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\net6.0-win-x64-release\download[PATREON] \64669643_media_147675729_1.jpg.dwnldtmp'. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) at UniversalDownloaderPlatform.DefaultImplementations.WebDownloader.DownloadFileInternal(String url, String path, String refererUrl, Int32 retry, Int32 retryTooManyRequests) in F:\Sources\BigProjects\PatreonDownloader\submodules\UniversalDownloaderPlatform\UniversalDownloaderPlatform.DefaultImplementations\WebDownloader.cs:line 218 2023-12-17 18:07:13.7679

Personally I found it weird that there was a space after the patreon name "...[PATREON NAME] \658749..." in comparison to "...[PATREON NAME]\658749..." , but I don't know much about coding so this might not matter at all.

bahdahbadha commented 8 months ago

I've figured out the issue! The creator I was trying to download from has a space at the end of their name which tries to make it into the path when downloading. This obviously means that the download path is unable to be found since well... Windows doesn't support spaces at the end of a path!

i.e. blah/blah /blah isn't supported as a valid path and when folders or files with spaces at the end are made they automatically turn into spaceless versions. (so a/b /c attempts to make a/b / which turns into a/b/ which then means that a/b /c is unable to be found)

I figured this out because this other patreon downloader [https://chromewebstore.google.com/detail/patreon-downloader/fmhpbbdpdhjkpbklloabkncldkmggaik] allows one to manually set the folder name. This automatic folder name (which usually is the patreon account you're downloading from) also had a space at the end of it. This implies to me that while the creator was setting their name that they accidentally left a space at the end.

However, highlighting their name in the page itself doesn't show this space at all? Further, this space isnt in the url either (because urls dont support spaces at all). I wonder why Patreon allowed their name to have a "hidden" space at the end at all, or how both tools (this and the other patreon downloader) is scraping this information whilst Patreon themselves are seemingly ignoring it (and therefore should've automatically removed it).

I am willing to share the patreon I was attempting to download from if needed (although I'd rather it be private).

TheSonic03 commented 7 months ago

Same issue. I resolved this by adding "--download-directory c:\downloads" for download the file in a specific folder. It's a workaround but it work.