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.02k stars 10.01k forks source link

youtube download fails via imported module, works from command line invocation #20493

Closed netllama closed 5 years ago

netllama commented 5 years ago

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2019.03.18. 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?


If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):

https://www.youtube.com/v/2yzMUs3badc


Description of your issue, suggested solution and other information

Trying to download via a python script import of youtube_dl consistently fails, yet attempting the same download with the command line invocation of youtube-dl works fine.

The youtube video in question is: https://www.youtube.com/v/2yzMUs3badc

The python script is doing the following (dl_files.values() the youtube URL from above):

    ydl_opts = {'outtmpl': '{}/%(title)s-%(id)s.%(ext)s'.format(dl_location),
                'logger': MyLogger(),
                'progress_hooks': [my_hook],
                'verbose': True,
                'prefer-free-formats': True,
                'audio-format': 'mp3',
                'continue': True,
                }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        try:
            print dl_files.values()
            ydl.download(dl_files.values())
        except Exception as err:
            print 'Error:\t{}'.format(err)
            return

Failing output via the python script is:

[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.09.15
[debug] Python version 2.7.15 - Linux-4.17.19-200.fc28.x86_64-x86_64-with-fedora-28-Twenty_Eight
[debug] exe versions: ffmpeg 4.0.3, ffprobe 4.0.3
[debug] Proxy map: {}
[u'https://www.youtube.com/v/2yzMUs3badc']
WARNING: Unknown codec av01.0.05M.08
WARNING: Unknown codec av01.0.05M.08
WARNING: Unknown codec av01.0.05M.08
WARNING: Unknown codec av01.0.05M.08
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
Saved: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4

Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f397.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f397.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f397.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f397.mp4
Downloading: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f397.mp4
Saved: /media0/tmp/tv/lonni/Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f397.mp4

FAILED: ERROR: To ignore this, add a trailing '?' to the map.
FAILED: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 2013, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/lib/python2.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 479, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/usr/lib/python2.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 204, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
FFmpegPostProcessorError: To ignore this, add a trailing '?' to the map.

Error:  ERROR: To ignore this, add a trailing '?' to the map.

When calling youtube-dl directly from the command line, it works:

$ youtube-dl -v 'https://www.youtube.com/v/2yzMUs3badc'
[debug] System config: [u'--prefer-free-formats']
[debug] User config: [u'--audio-format', u'mp3', u'--audio-quality', u'4', u'--continue', u'--add-metadata', u'--metadata-from-title', u'%(artist)s - %(title)s']
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://www.youtube.com/v/2yzMUs3badc']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.03.18
[debug] Python version 2.7.15 (CPython) - Linux-4.17.19-200.fc28.x86_64-x86_64-with-fedora-28-Twenty_Eight
[debug] exe versions: ffmpeg 4.0.3, ffprobe 4.0.3
[debug] Proxy map: {}
[youtube] 2yzMUs3badc: Downloading webpage
[youtube] 2yzMUs3badc: Downloading video info webpage
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on u'https://r4---sn-n4v7sne7.googlevideo.com/videoplayback?lmt=1553625406008620&expire=1553722541&ipbits=0&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397&dur=536.953&gir=yes&mime=video%2Fmp4&key=yt6&requiressl=yes&pcm2=yes&initcwndbps=785000&signature=1D6FFDF3A03053A147088C2D351FE0F39A10C078.DF0182D9579C3B82E67A6FA48B53E335F3C90DB8&mt=1553700895&mv=m&sparams=aitags%2Cclen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2%2Cpl%2Crequiressl%2Csource%2Cexpire&ms=au%2Conr&ip=204.11.225.78&c=WEB&clen=53201216&mm=31%2C26&mn=sn-n4v7sne7%2Csn-a5mlrnes&id=o-AGkfuQHna7H985sx_17Z9B-G0ZGI18f2UfzchDhwHcsO&keepalive=yes&source=youtube&txp=5535432&ei=TZibXIjoKca7kwbl-7YQ&itag=137&fvip=4&pl=22&ratebypass=yes'
[download] Destination: Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4
[download] 100% of 50.74MiB in 00:13
[debug] Invoking downloader on u'https://r4---sn-n4v7sne7.googlevideo.com/videoplayback?lmt=1553633076671989&expire=1553722541&ipbits=0&dur=536.981&gir=yes&mime=audio%2Fwebm&key=yt6&requiressl=yes&pcm2=yes&initcwndbps=785000&signature=427FAE89206B313B09CD1248CD47BF105143873D.D2203683B1BB295D633A8BEED753484FC17E9CCC&mt=1553700895&mv=m&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2%2Cpl%2Crequiressl%2Csource%2Cexpire&ms=au%2Conr&ip=204.11.225.78&c=WEB&clen=8688072&mm=31%2C26&mn=sn-n4v7sne7%2Csn-a5mlrnes&id=o-AGkfuQHna7H985sx_17Z9B-G0ZGI18f2UfzchDhwHcsO&keepalive=yes&source=youtube&txp=5511222&ei=TZibXIjoKca7kwbl-7YQ&itag=251&fvip=4&pl=22&ratebypass=yes'
[download] Destination: Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f251.webm
[download] 100% of 8.29MiB in 00:02
[ffmpeg] Merging formats into "Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4' -i 'file:Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f251.webm' -c copy -map '0:v:0' -map '1:a:0' 'file:Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.temp.mkv'
Deleting original file Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f137.mp4 (pass -k to keep)
Deleting original file Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.f251.webm (pass -k to keep)
[fromtitle] Could not interpret title of video as "%(artist)s - %(title)s"
[ffmpeg] Adding metadata to 'Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.mkv'
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.mkv' -c copy -metadata 'comment=A linguistic stereotype, explained.

This video is presented by Brilliant: https://brilliant.org/Vox/

Join the Video Lab! http://bit.ly/video-lab

Thank you the Video Lab members (Janet, Martian, and Mariko) who helped me with this video. To learn more about the video lab, visit vox.com/join

Check out Yuta’s Youtube channel here: https://www.youtube.com/user/YPlusShow

And browse Dr. Lawson’s ultrasound examples here: https://www.seeingspeech.ac.uk/r-and-l-in-english/

A foreign accent is when someone speaks a second language with the rules of their first language, and one of the most persistent and well-studied foreign-accent features is a lack of L/R contrast among native Japanese speakers learning English.

It’s so well-known that American soldiers in World War II reportedly used codewords like “lallapalooza” to distinguish Japanese spies from Chinese allies. But American movies and TV shows have applied this linguistic stereotype to Korean and Chinese characters too, like Kim Jong Il in Team America: World Police, or Chinese restaurant employees singing “fa ra ra ra ra” in A Christmas Story.

However, Japanese, Korean, and Chinese  are completely different languages that each handle L-sound and R-sounds differently. In this episode of Vox Observatory, we take a look at each language and how it affects pronunciation for English-language learners.

Vox.com is a news website that helps you cut through the noise and understand what'"'"'s really driving the events in the headlines. Check out http://www.vox.com.

Watch our full video catalog: http://goo.gl/IZONyE
Follow Vox on Facebook: http://goo.gl/U2g06o
Or Twitter: http://goo.gl/XFrZ5H' -metadata 'description=A linguistic stereotype, explained.

This video is presented by Brilliant: https://brilliant.org/Vox/

Join the Video Lab! http://bit.ly/video-lab

Thank you the Video Lab members (Janet, Martian, and Mariko) who helped me with this video. To learn more about the video lab, visit vox.com/join

Check out Yuta’s Youtube channel here: https://www.youtube.com/user/YPlusShow

And browse Dr. Lawson’s ultrasound examples here: https://www.seeingspeech.ac.uk/r-and-l-in-english/

A foreign accent is when someone speaks a second language with the rules of their first language, and one of the most persistent and well-studied foreign-accent features is a lack of L/R contrast among native Japanese speakers learning English.

It’s so well-known that American soldiers in World War II reportedly used codewords like “lallapalooza” to distinguish Japanese spies from Chinese allies. But American movies and TV shows have applied this linguistic stereotype to Korean and Chinese characters too, like Kim Jong Il in Team America: World Police, or Chinese restaurant employees singing “fa ra ra ra ra” in A Christmas Story.

However, Japanese, Korean, and Chinese  are completely different languages that each handle L-sound and R-sounds differently. In this episode of Vox Observatory, we take a look at each language and how it affects pronunciation for English-language learners.

Vox.com is a news website that helps you cut through the noise and understand what'"'"'s really driving the events in the headlines. Check out http://www.vox.com.

Watch our full video catalog: http://goo.gl/IZONyE
Follow Vox on Facebook: http://goo.gl/U2g06o
Or Twitter: http://goo.gl/XFrZ5H' -metadata 'artist=Vox' -metadata 'title=Why some Asian accents swap Ls and Rs in English' -metadata 'date=20190326' -metadata 'purl=https://www.youtube.com/watch?v=2yzMUs3badc' 'file:Why some Asian accents swap Ls and Rs in English-2yzMUs3badc.temp.mkv'
dstftw commented 5 years ago

Version you're using in python code is outdated.

netllama commented 5 years ago

Doh. Sorry about that.