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

view_count incorrect for YouTube videos when downloading playlists #27051

Closed apaloma closed 3 years ago

apaloma commented 3 years ago

Checklist

Verbose log

$ youtube-dl --output "Testing views - %(id)s - %(view_count)s views.%(ext)s" -f best -ciw -v --playlist-end 2 https://www.youtube.com/c/WhiteHouse/videos
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--output', u'Testing views - %(id)s - %(view_count)s views.%(ext)s', u'-f', u'best', u'-ciw', u'-v', u'--playlist-end', u'2', u'https://www.youtube.com/c/WhiteHouse/videos']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.11.17
[debug] Python version 2.7.12 (CPython) - Linux-4.4.0-194-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 2.8.17, ffprobe 2.8.17, rtmpdump 2.4
[debug] Proxy map: {}
[youtube:tab] WhiteHouse: Downloading webpage
[download] Downloading playlist: The White House - Videos
[youtube:tab] playlist The White House - Videos: Downloading 2 videos
[download] Downloading video 1 of 2
[youtube] TYwbGPxQLrs: Downloading webpage
[debug] Invoking downloader on u'https://r4---sn-nx5s7n7d.googlevideo.com/videoplayback?expire=1605660990&ei=3hy0X82EEsS9kwbFrpjgCg&ip=174.21.186.35&id=o-APO0IFOHuwehZifFfgAlh8iWFZCuPddjQ16EA9jt3eoG&itag=22&source=youtube&requiressl=yes&mh=KA&mm=31%2C29&mn=sn-nx5s7n7d%2Csn-nx57ynld&ms=au%2Crdu&mv=m&mvi=4&pl=17&initcwndbps=972500&vprv=1&mime=video%2Fmp4&ns=7yoOMXuPsIbPExmPWb9yeT4F&ratebypass=yes&dur=1949.431&lmt=1605528545444526&mt=1605639281&fvip=4&c=WEB&txp=5535432&n=gGJN5CyG1lSCoBp&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRAIgcyg__PDSl9ShJb3YZNKWYvGk3PkOsnoIu-XqHxaE78YCIF9TdpxkfjdVOacru9aV6T1z_jakGHhkhEGplWT-tAgJ&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgLVFv5EkLIia4Cdt7Y4Y7-U-Z99JXi4cUL3Lx1JDlM8QCIQCNraCiD9aiz921r-XQQkJsa3KxNVzNaxMZMXJ9tow0BA%3D%3D'
[download] Destination: Testing views - TYwbGPxQLrs - 102 views.mp4
[download] 100% of 182.84MiB in 00:04
[download] Downloading video 2 of 2
[youtube] rD1FNeaTlSM: Downloading webpage
[debug] Invoking downloader on u'https://r4---sn-nx5e6ne6.googlevideo.com/videoplayback?expire=1605660995&ei=4xy0X4zpNszFkgarvK_oBg&ip=174.21.186.35&id=o-AOKFenHaoz2FczfrfZzb8GRFMj5fCF12HQHYg2XrcZEu&itag=22&source=youtube&requiressl=yes&mh=U7&mm=31%2C29&mn=sn-nx5e6ne6%2Csn-nx5s7n76&ms=au%2Crdu&mv=m&mvi=4&pl=17&initcwndbps=972500&vprv=1&mime=video%2Fmp4&ns=5X6BJkYcT0l9fzRCvxCRAiAF&ratebypass=yes&dur=38.312&lmt=1605297093596521&mt=1605639281&fvip=4&c=WEB&txp=5432434&n=4rTnp3eDT62SYQ1&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRAIgEFki_vd30zl5_JShwxBasSe5z3kErEKtq-3WApdaVBICIE6fccMwbrabGN7T1l9MME3bGBR2Iekz3OmnGnJcuTLz&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgbu1Y_h6YWE8PD35J6pPZc351bZaNjweMOIpGaeQo9CoCIQCM8J8YkB9evdD5swap0iPy5mgSwBJlEhj_49fcG_drbA%3D%3D'
[download] Destination: Testing views - rD1FNeaTlSM - 25 views.mp4
[download] 100% of 2.07MiB in 00:00
[download] Finished downloading playlist: The White House - Videos

Description

It seems that the parsing of view counts on youtube videos does not work correctly when a playlist or channel is provided. For example, if a video has 102K views, then view_count will be 102. If "102K" is all that is provided by YouTube's API, then I think %(view_count)s returning 102K would be appropriate.

A single video works OK:

$ youtube-dl --output "Testing views - %(view_count)s views.%(ext)s" -f best -ciw -v http://www.youtube.com/watch?v=BaW_jenozKcj
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--output', u'Testing views - %(view_count)s views.%(ext)s', u'-f', u'best', u'-ciw', u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.11.17
[debug] Python version 2.7.12 (CPython) - Linux-4.4.0-194-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 2.8.17, ffprobe 2.8.17, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] BaW_jenozKc: Downloading webpage
[debug] Invoking downloader on u'https://r3---sn-nx5e6nez.googlevideo.com/videoplayback?expire=1605660761&ei=-Ru0X7bOIoiBkwa4pKjAAQ&ip=174.21.186.35&id=o-AD1cg_zIDxBXeEnGJ8x16Eyk3BGofcA3rRjp84-EIL7x&itag=22&source=youtube&requiressl=yes&mh=Rf&mm=31%2C29&mn=sn-nx5e6nez%2Csn-nx5s7n76&ms=au%2Crdu&mv=m&mvi=3&pl=17&initcwndbps=980000&vprv=1&mime=video%2Fmp4&ns=n_dFP_H3cOHtaHFIrZr4UtMF&ratebypass=yes&dur=9.891&lmt=1472250137564567&mt=1605639039&fvip=3&c=WEB&n=ah1IhGWC4fRbAys&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgVNeRKWZO1d28fig-nDLo4CdFnh8ZDXF9pwEhYDFbD4UCIQDtAg_V3BpRnZeSoh9ecwILfIIJ7PMbx8ycfYBIHo6Hsg%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgJ0AKHTweBZY_NfKifdTFezfNClzIqbpQaZfQ3Hoz9eYCIQC0peFptF5dxY1FazZa3IR7BfbhUEoAwaP1GZZULnTAiQ%3D%3D'
[download] Destination: Testing views - 32705 views.mp4
[download] 100% of 1.74MiB in 00:00
patryk-siewiera commented 3 years ago

I could confirm this; all of my parsed views are /1000 smaller

apaloma commented 3 years ago

remitamine fixed it. Try the latest version.

patryk-siewiera commented 3 years ago

I still got this issue in embed python version