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.66k stars 10.06k forks source link

Downloading Youtube playlist containing translated title results in inconsistent title. #27499

Open ghost opened 3 years ago

ghost commented 3 years ago

Checklist

Verbose log

Downloading a playlist

$ youtube-dl -v https://www.youtube.com/playlist?list=PLcRmrvAR4VMKRJ8ZBPiS0jlp9fRKQPprS
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://www.youtube.com/playlist?list=PLcRmrvAR4VMKRJ8ZBPiS0jlp9fRKQPprS']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.12.22
[debug] Python version 3.9.1 (CPython) - Linux-5.9.14-arch1-1-x86_64-with-glibc2.32
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube:tab] PLcRmrvAR4VMKRJ8ZBPiS0jlp9fRKQPprS: Downloading webpage
[download] Downloading playlist: test-1
[youtube:tab] playlist test-1: Downloading 1 videos
[download] Downloading video 1 of 1
[youtube] cJjqth04G1Q: Downloading 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 'https://r6---sn-ab02a0nfpgxapox-bh2es.googlevideo.com/videoplayback?expire=1608626321&ei=MVzhX92vBIbvrQSHw404&ip=121.67.187.140&id=o-AHfaEBI0i1eKbEcALQUoPv-CYSOGKHJ0292SekUITkUH&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397%2C398%2C399&source=youtube&requiressl=yes&mh=w6&mm=31%2C26&mn=sn-ab02a0nfpgxapox-bh2es%2Csn-oguelnle&ms=au%2Conr&mv=m&mvi=6&pl=24&initcwndbps=847500&vprv=1&mime=video%2Fmp4&ns=t6J956EgZmIyZ-DREFzvH6cF&gir=yes&clen=144010557&dur=192.249&lmt=1608289204151012&mt=1608604363&fvip=3&keepalive=yes&c=WEB&txp=5535432&n=1RIUPNKQ2cT0DXUN&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgcqpO5dhNUY-i84i1-P11H0JGH4BZ7Nc5jZXWJiLm3xICIGfxNZTqbEsvWEHm8Lafz5FgdUIDYAqJo9m2rnJQ-OD0&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAK5_IAQmXqFNGgmQ_92nbAaxLshNyxVfnzyvB2W9_7jBAiEA3nbn2pkjL07osGBpDlscabxUh3LWupakHVfMaVwjHVo%3D&ratebypass=yes'
[download] Destination: DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.f137.mp4
[download] 100% of 137.34MiB in 00:29
[debug] Invoking downloader on 'https://r6---sn-ab02a0nfpgxapox-bh2es.googlevideo.com/videoplayback?expire=1608626321&ei=MVzhX92vBIbvrQSHw404&ip=121.67.187.140&id=o-AHfaEBI0i1eKbEcALQUoPv-CYSOGKHJ0292SekUITkUH&itag=251&source=youtube&requiressl=yes&mh=w6&mm=31%2C26&mn=sn-ab02a0nfpgxapox-bh2es%2Csn-oguelnle&ms=au%2Conr&mv=m&mvi=6&pl=24&initcwndbps=847500&vprv=1&mime=audio%2Fwebm&ns=t6J956EgZmIyZ-DREFzvH6cF&gir=yes&clen=3022293&dur=192.281&lmt=1608288094929130&mt=1608604363&fvip=3&keepalive=yes&c=WEB&txp=5531432&n=1RIUPNKQ2cT0DXUN&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAIwmmJH4HogBO-NowHvU47_40uxFYcb-amCmYvqQOBPdAiEAuG3d1iBp11tx8nn9s0kJ_zqsq3bTnvCBIajYYEplXfo%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAK5_IAQmXqFNGgmQ_92nbAaxLshNyxVfnzyvB2W9_7jBAiEA3nbn2pkjL07osGBpDlscabxUh3LWupakHVfMaVwjHVo%3D&ratebypass=yes'
[download] Destination: DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.f251.webm
[download] 100% of 2.88MiB in 00:00
[ffmpeg] Merging formats into "DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.f137.mp4' -i 'file:DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file:DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.temp.mkv'
Deleting original file DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.f137.mp4 (pass -k to keep)
Deleting original file DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.f251.webm (pass -k to keep)
[download] Finished downloading playlist: test-1

Downloading a single video

$ youtube-dl -v https://www.youtube.com/watch?v=cJjqth04G1Q
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://www.youtube.com/watch?v=cJjqth04G1Q']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.12.22
[debug] Python version 3.9.1 (CPython) - Linux-5.9.14-arch1-1-x86_64-with-glibc2.32
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] cJjqth04G1Q: Downloading 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 'https://r6---sn-ab02a0nfpgxapox-bh2es.googlevideo.com/videoplayback?expire=1608626473&ei=yVzhX8vtKtiklQTp45vQAQ&ip=121.67.187.140&id=o-ADEP9OoUTMuXNbSbhi5BqkfKxKN3GpET6gsnhQF9ibkb&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397%2C398%2C399&source=youtube&requiressl=yes&mh=w6&mm=31%2C26&mn=sn-ab02a0nfpgxapox-bh2es%2Csn-oguelnle&ms=au%2Conr&mv=m&mvi=6&pl=24&initcwndbps=916250&vprv=1&mime=video%2Fmp4&ns=YcRH4XYoRJFJO2QEKbOGFUYF&gir=yes&clen=144010557&dur=192.249&lmt=1608289204151012&mt=1608604597&fvip=3&keepalive=yes&c=WEB&txp=5535432&n=JiuT3FMZrlUl418j&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAJkvHTLIeWMWz9hi2uek60D8FKgOnjmIXGJ0szrlOX9oAiEAoPAcATocvVFsZRSWrB2DGxigI42SwwcUPVkjugQyNsc%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgNrTaViBHY_Y5rXeVdTqMC9hwrxkK6W1qmAfbSQlEC-sCIQDhW9rBQbQrXCoi89ISC3WMii0V3qDyZxOxknLUNMPQzQ%3D%3D&ratebypass=yes'
[download] Destination: DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.f137.mp4
[download] 100% of 137.34MiB in 00:26
[debug] Invoking downloader on 'https://r6---sn-ab02a0nfpgxapox-bh2es.googlevideo.com/videoplayback?expire=1608626473&ei=yVzhX8vtKtiklQTp45vQAQ&ip=121.67.187.140&id=o-ADEP9OoUTMuXNbSbhi5BqkfKxKN3GpET6gsnhQF9ibkb&itag=251&source=youtube&requiressl=yes&mh=w6&mm=31%2C26&mn=sn-ab02a0nfpgxapox-bh2es%2Csn-oguelnle&ms=au%2Conr&mv=m&mvi=6&pl=24&initcwndbps=916250&vprv=1&mime=audio%2Fwebm&ns=YcRH4XYoRJFJO2QEKbOGFUYF&gir=yes&clen=3022293&dur=192.281&lmt=1608288094929130&mt=1608604597&fvip=3&keepalive=yes&c=WEB&txp=5531432&n=JiuT3FMZrlUl418j&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgdkCMEy7U8xH8k8izHnoCpMeZZBtiNikAAydfvrpRRYcCIASkn6kKyNslS5PeyVg0ufZhS2KSqvUfmqttEYrxptEZ&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgNrTaViBHY_Y5rXeVdTqMC9hwrxkK6W1qmAfbSQlEC-sCIQDhW9rBQbQrXCoi89ISC3WMii0V3qDyZxOxknLUNMPQzQ%3D%3D&ratebypass=yes'
[download] Destination: DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.f251.webm
[download] 100% of 2.88MiB in 00:00
[ffmpeg] Merging formats into "DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.f137.mp4' -i 'file:DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file:DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.temp.mkv'
Deleting original file DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.f137.mp4 (pass -k to keep)
Deleting original file DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.f251.webm (pass -k to keep)

Description

I know there's some issues citing auto translated video title, but this is a little bit different.

I tried to download this video: https://www.youtube.com/watch?v=cJjqth04G1Q

Downloading it by its URL is working well. Title is not translated and it's good. But downloading a playlist including that video results in translated title. This error makes some of YoutubeDL's feature inconsistent.

$ youtube-dl --get-title https://www.youtube.com/watch?v=cJjqth04G1Q
DECO*27 - 依存香炉 feat. 初音ミク
$ youtube-dl --get-title https://www.youtube.com/playlist?list=PLcRmrvAR4VMKRJ8ZBPiS0jlp9fRKQPprS
DECO*27 - Addiction feat. Hatsune Miku

$ youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=cJjqth04G1Q
# DECO_27 - 依存香炉 feat. 初音ミク-cJjqth04G1Q.mp3
$ youtube-dl --extract-audio --audio-format mp3  https://www.youtube.com/playlist?list=PLcRmrvAR4VMKRJ8ZBPiS0jlp9fRKQPprS
# DECO_27 - Addiction feat. Hatsune Miku-cJjqth04G1Q.mp3

Different results on same resources

ghost commented 3 years ago

Additional question, what does YoutubeDL do to get around the translated title?

windosx64 commented 3 years ago

I googled the artifact "cJjqth04G1Q" and the music you are trying to download was the first result. Doesn't appear on the page though with ctrl+f. You are not using an output template. The default template is '%(title)s-%(id)s.%(ext)s'. I used youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" https://www.youtube.com/playlist?list=PLcRmrvAR4VMKRJ8ZBPiS0jlp9fRKQPprS and the artifact is gone. It must be related to the ID. Translated too!

tujidelv commented 3 years ago

Additional question, what does YoutubeDL do to get around the translated title?

Excuse me, has this problem been solved? I also have this problem

ghost commented 3 years ago

@tujidelv

I'm not sure, but at least extracting title with direct URL did result in non-translated title.

My context about this issue is that I was trying to do some work with YoutubeDL's output including filename, but downloaded filenames were different if a playlist contains translated filename. My workaround is to use --flat-playlist option when requesting playlist information, build URL for every item from the result, re-request them as a direct URL rather than playlist URL.

For example, (youtube-dl, jq required)

#!/bin/bash

playlist="https://www.youtube.com/playlist?list=a-playlist-id"

ids=$(youtube-dl --dump-json --flat-playlist ${playlist} | jq -s -r 'map(.)[].url')

readarray -t <<< "${ids}"
for id in "${MAPFILE[@]}"
do
    youtube-dl --get-title https://www.youtube.com/watch?v=${id}
done

replace playlist variable and run it, you can get non-translated title. Tested with YoutubeDL 2021.01.16