ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.65k stars 10.06k forks source link

Default filename won't work when saving videos from long tweets #17924

Closed omgitsraven closed 6 years ago

omgitsraven commented 6 years ago

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

Before submitting an issue make sure you have:

What is the purpose of your issue?


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 ```):

PS C:\Other Programs\youtube-dl> .\youtube-dl.exe -v https://twitter.com/RavenTest/status/1053354601607561
217
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://twitter.com/RavenTest/status/1053354601607561217']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2018.10.05
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17134
[debug] exe versions: ffmpeg 4.0.2, ffprobe 4.0.2
[debug] Proxy map: {}
[twitter] 1053354601607561217: Downloading webpage
[twitter:card] 1053354601607561217: Downloading webpage
[twitter:card] 1053354601607561217: Downloading guest token
[twitter:card] 1053354601607561217: Downloading JSON metadata
[twitter:card] 1053354601607561217: Downloading m3u8 information
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://video.twimg.com/ext_tw_video/1053354339530653697/pu/pl/1280x720/6nenL5yEtmNhiMYj.m3u8'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 7
[download] Destination: RavenTest - Here is a tweet with a video attached but also lots and lots of text in its body, enough text that Windows filesystems will produce the bug where youtube-dl isn't able to write .part fi...-1053354601607561217.mp4
ERROR: unable to open for writing: [Errno 2] No such file or directory: "RavenTest - Here is a tweet with a video attached but also lots and lots of text in its body, enough text that Windows filesystems will produce the bug where youtube-dl isn't able to write .part fi...-1053354601607561217.mp4.part-Frag0.part"
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\downloader\http.py", line 250, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\utils.py", line 457, in sanitize_open
FileNotFoundError: [Errno 2] No such file or directory: "RavenTest - Here is a tweet with a video attached but also lots and lots of text in its body, enough text that Windows filesystems will produce the bug where youtube-dl isn't able to write .part fi...-1053354601607561217.mp4.part-Frag0.part"

Description of your issue, suggested solution and other information

When using youtube-dl to save a video attached to a tweet, the body of the tweet is used as the filename -- however, this can produce invalid filenames, at least on Windows. Using -o myfilename.mp4 is enough to work around this, but it would be nice if that weren't necessary :)

Note that this problem doesn't occur with very very small videos—the bug only happens when it tries to create .part files, not the actual video files themselves.

In short: youtube-dl.exe https://twitter.com/RavenTest/status/1053357651101470729 WORKS (short video on long tweet)

youtube-dl.exe https://twitter.com/RavenTest/status/1053359277916721154 WORKS (long video on short tweet)

youtube-dl.exe https://twitter.com/RavenTest/status/1053354601607561217 does NOT work (long video on long tweet with default filename)

youtube-dl.exe -o test.mp4 https://twitter.com/RavenTest/status/1053354601607561217 WORKS (long video on long tweet with manual filename)

omgitsraven commented 6 years ago

Where is the issue that this is a duplicate of? I looked and couldn't find any