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

Spaces in title get stripped by downloader, causing errors #20312

Closed
hseg opened this issue Mar 10, 2019 · 1 comment
Closed

Spaces in title get stripped by downloader, causing errors #20312

hseg opened this issue Mar 10, 2019 · 1 comment
Labels

Comments

@hseg
Copy link

@hseg hseg commented Mar 10, 2019

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2019.03.09. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2019.03.09

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

[debug] System config: []
[debug] User config: ['--external-downloader', 'aria2c', '--external-downloader-args', '--dir . -j 5 -x 5 -s 5 -c -k 1MB', '--format', 'best[filesize<300MB]/best']
[debug] Custom config: []
[debug] Command-line args: ['-v', 'agZ0xISi40E']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.03.09
[debug] Python version 3.7.2 (CPython) - Linux-5.0.0-arch1-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 4.1.1, ffprobe 4.1.1
[debug] Proxy map: {}
[youtube] agZ0xISi40E: Downloading webpage
[youtube] agZ0xISi40E: Downloading video info webpage
[debug] Invoking downloader on 'https://r2---sn-uxa15gpou-ua8e.googlevideo.com/videoplayback?mm=31%2C29&mn=sn-uxa15gpou-ua8e%2Csn-4g5ednee&dur=343.074&id=o-AP-fbfCKxvLmhEla-XgdD-1yf7cLsNUkDgXgpKKvIjMx&source=youtube&mv=m&ms=au%2Crdu&fvip=4&key=yt6&ip=141.226.82.15&lmt=1552232510083300&pcm2cms=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ipbits=0&ratebypass=yes&txp=4531432&requiressl=yes&c=WEB&initcwndbps=122500&signature=8F39EEABADC02EE40D82941C9FD88CA4A8E13912.88A5E21E25BD600AA7106EC5EE32FB932D9390B0&mime=video%2Fmp4&ei=hGWFXJeCA8im1gLO1ZzIDg&mt=1552246025&pl=24&gir=yes&clen=12989551&itag=18&expire=1552267748'
[download] Destination:  The EU's 'SECRET' Brexit Negotiation EXPOSED 🙄-agZ0xISi40E.mp4
[debug] aria2c command line: aria2c -c --dir . -j 5 -x 5 -s 5 -c -k 1MB --out ' The EU'"'"'s '"'"'SECRET'"'"' Brexit Negotiation EXPOSED 🙄-agZ0xISi40E.mp4.part' --header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0' --header 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' --header 'Accept-Encoding: gzip, deflate' --header 'Accept-Language: en-us,en;q=0.5' --check-certificate=true -- 'https://r2---sn-uxa15gpou-ua8e.googlevideo.com/videoplayback?mm=31%2C29&mn=sn-uxa15gpou-ua8e%2Csn-4g5ednee&dur=343.074&id=o-AP-fbfCKxvLmhEla-XgdD-1yf7cLsNUkDgXgpKKvIjMx&source=youtube&mv=m&ms=au%2Crdu&fvip=4&key=yt6&ip=141.226.82.15&lmt=1552232510083300&pcm2cms=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ipbits=0&ratebypass=yes&txp=4531432&requiressl=yes&c=WEB&initcwndbps=122500&signature=8F39EEABADC02EE40D82941C9FD88CA4A8E13912.88A5E21E25BD600AA7106EC5EE32FB932D9390B0&mime=video%2Fmp4&ei=hGWFXJeCA8im1gLO1ZzIDg&mt=1552246025&pl=24&gir=yes&clen=12989551&itag=18&expire=1552267748'

03/10 21:33:39 [NOTICE] Downloading 1 item(s)

03/10 21:33:39 [NOTICE] GID#4bc289ee2f73f0e0 - Download has already completed: ./The EU's 'SECRET' Brexit Negotiation EXPOSED 🙄-agZ0xISi40E.mp4.part

03/10 21:33:39 [NOTICE] Download complete: ./The EU's 'SECRET' Brexit Negotiation EXPOSED 🙄-agZ0xISi40E.mp4.part

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
4bc289|OK  |       0B/s|./The EU's 'SECRET' Brexit Negotiation EXPOSED 🙄-agZ0xISi40E.mp4.part

Status Legend:
(OK):download completed.
ERROR: unable to download video data: [Errno 2] No such file or directory: " The EU's 'SECRET' Brexit Negotiation EXPOSED 🙄-agZ0xISi40E.mp4.part"
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1913, in process_info
    success = dl(filename, info_dict)
  File "/usr/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1852, in dl
    return fd.download(name, info)
  File "/usr/lib/python3.7/site-packages/youtube_dl/downloader/common.py", line 364, in download
    return self.real_download(filename, info_dict)
  File "/usr/lib/python3.7/site-packages/youtube_dl/downloader/external.py", line 52, in real_download
    fsize = os.path.getsize(encodeFilename(tmpfilename))
  File "/usr/lib/python3.7/genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: " The EU's 'SECRET' Brexit Negotiation EXPOSED 🙄-agZ0xISi40E.mp4.part"

Description of your issue, suggested solution and other information

Judging by the output, the issue seems to be that aria2c strips the whitespace at the beginning of the file name even when this is explicitly requested. Raised the issue upstream as aria2/aria2#1373,
but I'm noting this here in case someone else runs into this issue.
The problem can be worked around by explicitly renaming the intermediate file to what youtube-dl
expects.

@dstftw dstftw closed this Mar 10, 2019
@hseg
Copy link
Author

@hseg hseg commented Mar 24, 2019

aria2 are declining to fix the bug, see aria2/aria2#1373 -- they claim
leading/trailing whitespace in filenames is a misfeature.
Argument about whether they should support this behaviour aside, their argument
is fair in that sanitize_filename should also strip whitespace.
Then the default output template wouldn't be sensitive to stripping and anyone
who inserted whitespace in manually would be getting what they deserved.

Thoughts? Implementation would be simply a matter of replacing strip('_') by
strip(' _') in sanitize_filename.

@hseg hseg mentioned this issue Apr 10, 2019
3 of 9 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.