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.48k stars 10.04k forks source link

Incorrect zero padding of playlist_index when downloading partial playlists #26399

Open ToaKraka opened 4 years ago

ToaKraka commented 4 years ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--ignore-config', u'--playlist-start', u'2', u'--playlist-end', u'10', u'-o', u'%(playlist_index)s.%(ext)s', u'-v', u'-f', u'worstaudio', u'--no-progress', u'https://www.youtube.com/playlist?list=PLPGIB5enMsxJI7W45angtnUpyHk_OBw4x']
[debug] Encodings: locale UTF-8, fs UTF-8, out None, pref UTF-8
[debug] youtube-dl version 2020.07.28
[debug] Python version 2.7.17 (CPython) - Linux-4.14.141-169-armv7l-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.2, ffprobe 3.4.2
[debug] Proxy map: {}
[youtube:playlist] PLPGIB5enMsxJI7W45angtnUpyHk_OBw4x: Downloading webpage
[download] Downloading playlist: Battle Brothers Season 11 - Warriors of the North, Davkul Cultists (Completed)
[youtube:playlist] playlist Battle Brothers Season 11 - Warriors of the North, Davkul Cultists (Completed): Downloading 9 videos
[download] Downloading video 1 of 9
[youtube] PPzHQ4BXLpo: Downloading webpage
[youtube] PPzHQ4BXLpo: Downloading MPD manifest
[debug] Invoking downloader on u'https://manifest.googlevideo.com/api/manifest/dash/expire/1598031362/ei/orE_X6jaKMWYhwbosaygBg/ip/108.24.193.10/id/3cfcc74380572e9a/source/youtube/requiressl/yes/playback_host/r3---sn-8xgp1vo-ab5s.googlevideo.com/mh/ug/mm/31%2C29/mn/sn-8xgp1vo-ab5s%2Csn-ab5szn7k/ms/au%2Crdu/mv/m/mvi/3/pl/16/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/1961250/vprv/1/mt/1598009674/fvip/3/keepalive/yes/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRgIhANKhGhFhjpafKxSGUmja0065Qwxc40uiBsn8WvOflr3EAiEAlwf0WAGz1Ntt8awPmIHi3ZEC8sN0JpyWZNCZA7moGwY%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRgIhAPwsv0VD-udcaBmT2COyo4DW0o4dr4-waoHhEW9L05AnAiEAtcP-4nwORU-PTnxYon1QE63NFlJoef1b_qTjUba5Biw%3D'
[dashsegments] Total fragments: 228
[download] Destination: 2.m4a
[download] Download completed
[ffmpeg] Correcting container in "2.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:2.m4a' -c copy -f mp4 'file:2.temp.m4a'
[download] Downloading video 2 of 9
[youtube] A4LN1NqFW9E: Downloading webpage
[debug] Invoking downloader on u'https://r5---sn-8xgp1vo-ab5e.googlevideo.com/videoplayback?expire=1598031403&ei=y7E_X_CxItHq8wT5t6XAAg&ip=108.24.193.10&id=o-AK_mc2Dj1oWjK3NQhKJwNCg6EAe-y3AfHLUrquJmFgOb&itag=249&source=youtube&requiressl=yes&mh=JW&mm=31%2C29&mn=sn-8xgp1vo-ab5e%2Csn-ab5sznlk&ms=au%2Crdu&mv=m&mvi=5&pl=16&initcwndbps=1568750&vprv=1&mime=audio%2Fwebm&gir=yes&clen=16169934&dur=2631.021&lmt=1561852475897263&mt=1598009674&fvip=5&keepalive=yes&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgF6G-Ol3c5mobnSvS_a7aTS6oVp88CxfZsHDL3KIkRh8CIGgxweqP2LjrMssl0W5Lx7td-oagZtbbuxANXaGAYe-G&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgfedwSs0PSSio2G-MyjqeVk2KHqt_8lss61K1N00_-BQCIQCTGz4DB2LLh5QxrQ_ZVrULjnieDSXb9FfTh_W7X7ATuw%3D%3D&ratebypass=yes'
[download] Destination: 3.webm
[download] Download completed
[download] Downloading video 3 of 9
[youtube] nlOwYjoU1mc: Downloading webpage
[debug] Invoking downloader on u'https://r2---sn-8xgp1vo-ab5s.googlevideo.com/videoplayback?expire=1598031407&ei=z7E_X-jLC47egwOkqpbwBA&ip=108.24.193.10&id=o-ALlovpn21PXggGZKrvdPRR2H8sBuXkw0-b0fU9q3ShVZ&itag=249&source=youtube&requiressl=yes&mh=wS&mm=31%2C29&mn=sn-8xgp1vo-ab5s%2Csn-ab5szn7e&ms=au%2Crdu&mv=m&mvi=2&pl=16&initcwndbps=1961250&vprv=1&mime=audio%2Fwebm&gir=yes&clen=14273814&dur=2347.041&lmt=1561780896640285&mt=1598009674&fvip=2&keepalive=yes&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgKgCGmjeTzxlbu_R41ZmMkisEUp4GINX0OakXarFjyDQCIQDqfrNRfqU4QTKCvs-WenefGWxhCb76PGRcG_abY2XD6g%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAJYaQecaNOr_lWKhV7TGalPMQFZAxqARREhD7L5tLEIPAiA7Ca0YIENgfOtkrMhiGHXWp9u5aLLVko0z5CcXlpaMSg%3D%3D&ratebypass=yes'
[download] Destination: 4.webm
[download] Download completed
[download] Downloading video 4 of 9
[youtube] N48HZ0F-dhQ: Downloading webpage
[debug] Invoking downloader on u'https://r7---sn-8xgp1vo-ab5e.googlevideo.com/videoplayback?expire=1598031411&ei=07E_X6-LIY_fhwbBxa34Bw&ip=108.24.193.10&id=o-APmyMB8dz4w69xFUSB6VENR5ztkN4Ncw5Wf9vnQA62Mg&itag=249&source=youtube&requiressl=yes&mh=MN&mm=31%2C29&mn=sn-8xgp1vo-ab5e%2Csn-ab5sznl7&ms=au%2Crdu&mv=m&mvi=7&pl=16&initcwndbps=1568750&vprv=1&mime=audio%2Fwebm&gir=yes&clen=15430233&dur=2519.041&lmt=1561005217925221&mt=1598009674&fvip=4&keepalive=yes&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAPEJfkPvPhvvE-Knqn9udlW-Ek_IqYgN7VDI5nglXvo8AiEA4Qne7DUsi-GWqqiiOOechAGaILyocWkZFQaAjH5lzKA%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhANrcPLZ2xifN9VkNs290EckiUbAE7I628iPNAtsFnYukAiEA4TUqs31e74ET7dwLG4TMX9EjyW4QuoHp7u2x9vzlvqQ%3D&ratebypass=yes'
[download] Destination: 5.webm
[download] Download completed
[download] Downloading video 5 of 9
[youtube] xDTtKamtY2s: Downloading webpage
[debug] Invoking downloader on u'https://r3---sn-8xgp1vo-ab5s.googlevideo.com/videoplayback?expire=1598031417&ei=2bE_X4GDKuqP8gS0t7zICw&ip=108.24.193.10&id=o-AJPH96HIzx06jWScRjjc9hH5ZWzUGX8nFXIieNsM7nYQ&itag=140&source=youtube&requiressl=yes&mh=pi&mm=31%2C29&mn=sn-8xgp1vo-ab5s%2Csn-ab5l6nzs&ms=au%2Crdu&mv=m&mvi=3&pl=16&initcwndbps=1961250&vprv=1&mime=audio%2Fmp4&gir=yes&clen=32256466&dur=1993.061&lmt=1562059465067192&mt=1598009674&fvip=3&keepalive=yes&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgMzX-XEItMequl2pOJKv8ppSdEbgHXDm-AlidhPpCXWACIEKjMPYw6CG2_N3Vhw03PD6zJDR0IFNfUay1-1pEF5vs&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAKFl5PWwp8npiaBYuK22bpbT9X6WU5XZfGuji1qqnXO9AiEAmjTpD5gkBD--tDqzQy_Qtks23IWnB_Oj7ZGc0wQbLww%3D&ratebypass=yes'
[download] Destination: 6.m4a
[download] Download completed
[ffmpeg] Correcting container in "6.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:6.m4a' -c copy -f mp4 'file:6.temp.m4a'
[download] Downloading video 6 of 9
[youtube] YRK0oxPXk4g: Downloading webpage
[debug] Invoking downloader on u'https://r7---sn-8xgp1vo-ab5s.googlevideo.com/videoplayback?expire=1598031424&ei=4LE_X5XgM8Pl8wSUpr-IDA&ip=108.24.193.10&id=o-ANNOX_CU-RELda8Il9e4dqPyrTCK7rXWTW6OAtJ-LJ88&itag=249&source=youtube&requiressl=yes&mh=LF&mm=31%2C29&mn=sn-8xgp1vo-ab5s%2Csn-ab5l6n6e&ms=au%2Crdu&mv=m&mvi=7&pl=16&initcwndbps=1961250&vprv=1&mime=audio%2Fwebm&gir=yes&clen=17294043&dur=2819.021&lmt=1561029966655221&mt=1598009674&fvip=3&keepalive=yes&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgeAKnDnIvfGPHj2v6LssTi1WRYjBkvMTZGot-MrT5g_4CIQC77DGDKzvuDpo-xcWH81Qi8sQ4Jh017rTlD_4m_m3wRw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAM5f3Ag0fj8kljDr32FM-lNpNHn0hEhwuLaqMTxc7qc-AiAgHLG6E7rZ9soBJo1F5i8JIo7LHuhtwqPQbS1UZQNHWQ%3D%3D&ratebypass=yes'
[download] Destination: 7.webm
[download] Download completed
[download] Downloading video 7 of 9
[youtube] s81J5s8zajs: Downloading webpage
[youtube] s81J5s8zajs: Downloading MPD manifest
[debug] Invoking downloader on u'https://manifest.googlevideo.com/api/manifest/dash/expire/1598031428/ei/5LE_X4mnJZmDhwaYjLmwCw/ip/108.24.193.10/id/b3cd49e6cf336a3b/source/youtube/requiressl/yes/playback_host/r3---sn-8xgp1vo-ab5e.googlevideo.com/mh/BO/mm/31%2C29/mn/sn-8xgp1vo-ab5e%2Csn-ab5szn7k/ms/au%2Crdu/mv/m/mvi/3/pl/16/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/1568750/vprv/1/mt/1598009674/fvip/3/keepalive/yes/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Chfr%2Cas%2Cvprv%2Citag/sig/AOq0QJ8wRQIgSh44H6c_kiCiZM6XV_oofe-1rcVyG3JUxr3zFitncsoCIQCN-YD3tNS61cDzEkfvJu7HdS4dzHb0VJwKmyvkIF15KQ%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AG3C_xAwRgIhAMMO0rYxJC48v7xqbePe6Z7KaIdPmBS4cYMkAa9ZO9uOAiEAhl7Hfu6_MIdGssoR0XBdK9raEUZbWHMF0LOqvK15qNI%3D'
[dashsegments] Total fragments: 270
[download] Destination: 8.m4a
[download] Download completed
[ffmpeg] Correcting container in "8.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:8.m4a' -c copy -f mp4 'file:8.temp.m4a'
[download] Downloading video 8 of 9
[youtube] lsyGerIP1u4: Downloading webpage
[debug] Invoking downloader on u'https://r6---sn-8xgp1vo-ab5e.googlevideo.com/videoplayback?expire=1598031501&ei=LLI_X77qOaeHhwbQ0pHAAw&ip=108.24.193.10&id=o-AGDvVFwQmIpYrmHN5LvxxrqYh_MB_gG732_gPFXfyBUW&itag=249&source=youtube&requiressl=yes&mh=Qb&mm=31%2C29&mn=sn-8xgp1vo-ab5e%2Csn-ab5l6n6e&ms=au%2Crdu&mv=m&mvi=6&pcm2cms=yes&pl=16&initcwndbps=1682500&vprv=1&mime=audio%2Fwebm&gir=yes&clen=14993969&dur=2473.041&lmt=1561053226715452&mt=1598009795&fvip=6&keepalive=yes&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgWb0jAvg_D_h1WSIxMrfL-X_HX5xuNgF3CIl3BHMkYusCIQCJuQHoaxS0tLb9EpDw8V2DgVYyd2j_6H44zayWoErJLA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgP--2FrbhLyPdKZvFjkH-XCQ1gf3_YxN0BWeIXhWfbEkCIQC4z4YVgbOZwIgZ4phlL3QB2U6s5iKc215cybl-0sw9QQ%3D%3D&ratebypass=yes'
[download] Destination: 9.webm
[download] Download completed
[download] Downloading video 9 of 9
[youtube] CngNV6GfUsM: Downloading webpage
[debug] Invoking downloader on u'https://r2---sn-8xgp1vo-ab5l.googlevideo.com/videoplayback?expire=1598031505&ei=MbI_X-SVB5aw8wSJtqPIAQ&ip=108.24.193.10&id=o-AIkhlNmBhvq0_JmjlPNqxOHiUja8IhzRTZ15YXJ5gfmb&itag=249&source=youtube&requiressl=yes&mh=tj&mm=31%2C29&mn=sn-8xgp1vo-ab5l%2Csn-ab5szn7z&ms=au%2Crdu&mv=m&mvi=2&pl=16&initcwndbps=2123750&vprv=1&mime=audio%2Fwebm&gir=yes&clen=18158592&dur=2963.041&lmt=1561064357633087&mt=1598009795&fvip=2&keepalive=yes&c=WEB&txp=5431432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAO_e3SMf-JqLGZjHDBnaSwrx7fDW4IUeC0mXtmii-EeNAiB_kRPZOWmpxrt4eOdouYtRRavG8PUqYNwomWXeRvOcOA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgE3ELr3J1eNfBENNVkk5sJXaNfbhBiiT9GBcvJkGQz74CIAHE_tYxk3PJDHp-fGjFZBakd3BlMN3UwnpQkgo9z02w&ratebypass=yes'
[download] Destination: 10.webm
[download] Download completed
[download] Finished downloading playlist: Battle Brothers Season 11 - Warriors of the North, Davkul Cultists (Completed)

Description

If you download an entire 100-video playlist, the playlist_index key will be padded with leading zeroes to three digits for all videos downloaded. However, if you use --playlist-start 2 --playlist-end 100 to download only 99 videos from the same playlist, playlist_index will be padded only to two digits, rather than to the expected three digits. Likewise, if you use --playlist-start 2 --playlist-end 10 to download only nine videos from the same 100-video playlist, playlist_index will not be padded at all.

Apparently, the program considers only the count of videos to be downloaded in determining the padding. According to the readme, however, it is supposed to consider the total length of the playlist.

apjyotirmay commented 3 years ago

Can confirm this happening on the latest build 2021.03.03. Some files have leading 0s, and some don't just because total number of items reduced because of using --playlist-start