JuanBindez / pytubefix

Python3 library for downloading YouTube Videos.
https://pytubefix.readthedocs.io
MIT License
729 stars 101 forks source link

[Error] downloading mp3 with Python and Pytubefix #283

Closed JuanBindez closed 1 month ago

JuanBindez commented 1 month ago

Describe the bug I recently saw someone on a forum complaining about this error when trying to download an mp3, the error is due to the "?" but I realized that the mp3 parameter had a bug that was naming the filename by itself when in fact it should leave it up to the user to choose the name or if the user does not provide a filename then the library should do the correct naming with the prefix mp3, in addition the parameter is not passing through the file_system for a download compatible with each file system

https://4each.com.br/threads/python-erro-de-download-de-mp3-com-python-e-pytubefix.50610/


code that was used that resulted in the bug

from pytubefix import YouTube

# put your code here

Expected behavior A clear and concise description of what you expected to happen.


Screenshots image


Desktop (please complete the following information):

>>> from pytubefix import info
>>> 
>>> print(info())
{'OS': 'linux', 'Python': '3.11.6 (main, Apr 10 2024, 17:26:07) [GCC 13.2.0]', 'Pytubefix': '8.0.0'}
>>> 

Additional context Add any other context about the problem here.

jhanley-com commented 1 month ago

Please do not post text as a screenshot. Copy and paste into your post.

What is the URL? No, I am not going to try and hand type it from your image.

The error message indicates that PyTubeFix cannot create a file. That means something is probably wrong with the file name or location.

The error futher indicates Errno 22, which means the argument is invalid - further indicating a problem with the file name

I don't think this is a bug with PyTubeFix.

JuanBindez commented 1 month ago

Please do not post text as a screenshot. Copy and paste into your post.

What is the URL? No, I am not going to try and hand type it from your image.

The error message indicates that PyTubeFix cannot create a file. That means something is probably wrong with the file name or location.

The error futher indicates Errno 22, which means the argument is invalid - further indicating a problem with the file name

I don't think this is a bug with PyTubeFix.

You are correct, but in addition to the error (OSError: [Errno 22] Invalid argument: ) there was a bug that was fixed here #284

JuanBindez commented 1 month ago

the mp3 parameter was not treating the characters that cause problems in Windows and that is why it generated the error, in addition there was another problem in relation to the filename which was named "alone"