title: How to Extract The upload dates, Titles, URLs and Durations from Youtube videos in a Playlist with youtube-dl?
body: <p>I'm trying to extract the <code>Upload Dates</code>, <code>Titles</code>, <code>URLs</code> and <code>Durations</code> from all the Youtube videos of a specific Playlist with <code>youtube-dl</code>, I don't need the videos - just the above pieces of data.</p>
  <p>So far I've tested the following two approaches suggested here by <a href="https://stackoverflow.com/a/61641251/10789707">Alen Paul Varghese</a> :</p>
  <p><a href="http://youtube-dl%20--get-upload_date%20https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD%20%3E%20example.txt" rel="nofollow noreferrer">Youtube-dl's GitHub Doc Used as reference</a></p>
  <p><a href="https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD" rel="nofollow noreferrer">The Playlist URL used for testing</a></p>
  <h2><strong>APPROACH #1</strong></h2>
  <pre><code>youtube-dl --skip-download --print-json https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD &gt; example.json
  </code></pre>
  <p>and</p>
  <h2><strong>APPROACH #2</strong></h2>
  <pre><code>youtube-dl --get-upload_date https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD &gt; example.txt
  </code></pre>
  <p><strong>APPROACH #1</strong> outputs a whole json dump — about 3000 lines per video - very inconvenient to handle for large number Youtube videos Playlists - but it contains the 4 needed data.</p>
  <p><strong>APPROACH #2</strong> returns the following error:</p>
  <pre><code>youtube-dl: error: no such option: --get-upload_date
  </code></pre>
  <p>I wanted to favor <strong>APPROACH #2</strong> to limit the output data to just the ones needed (<code>upload dates</code>, <code>Titles</code>, <code>URLs</code> and <code>Durations</code>), following  <a href="https://stackoverflow.com/a/61641251/10789707">Alen Paul Varghese's 2nd suggestion</a> and after checking the <code>upload_date</code> is a valid <code>youtube-dl</code> option here <a href="https://github.com/ytdl-org/youtube-dl/#output-template" rel="nofollow noreferrer">Youtube-dl's GitHub Doc Used as reference</a>.</p>
  <p>Why doesn't the <code>upload_data</code> option get validated?</p>
  <p>What alternative in order to limit the data?</p>
  <p>I would appreciate very much your helpful advice.</p>
  <p>Here's the json dump file:
  <a href="https://filebin.net/1ojxhqketeudefg9" rel="nofollow noreferrer">example.json</a></p>
  <hr />
  <h2>EDIT (Thanks to @PIERPY GREAT GUIDANCE -
  FULL DOCUMENTED COMPLIMENTARY PROCESS -
  HELPFUL TO OTHERS):</h2>
  <hr />
  <p><strong>I've successfully installed <a href="https://chocolatey.org/" rel="nofollow noreferrer">Chocolatey NuGet</a> with <code>Admin CMD</code> to install jq 1.5 with <code>chocolatey install jq</code> as required by <a href="https://stedolan.github.io/jq/download/" rel="nofollow noreferrer">Download jq - Windows</a></strong></p>
  <p><strong>My <code>Chocolatey NuGet</code> Installation Output:</strong></p>
  <pre><code>    Microsoft Windows [Version 10.0.19042.867]
  (c) 2020 Microsoft Corporation. All rights reserved.
  C:\WINDOWS\system32&gt;@&quot;%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe&quot; -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command &quot;iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))&quot; &amp;&amp; SET &quot;PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin&quot;                                                         
  Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)                                        
  Getting latest version of the Chocolatey package for download.                                                          
  Not using proxy.
  Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/0.10.15.
  Downloading https://community.chocolatey.org/api/v2/package/chocolatey/0.10.15 to C:\Users\###\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
  Not using proxy.
  Extracting C:\Users\###\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\###\AppData\Local\Temp\chocolatey\chocoInstall
  Installing Chocolatey on the local machine
  Creating ChocolateyInstall as an environment variable (targeting 'Machine')
    Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
  WARNING: It's very likely you will need to close and reopen your shell
    before you can use choco.
  Restricting write permissions to Administrators
  We are setting up the Chocolatey package repository.
  The packages themselves go to 'C:\ProgramData\chocolatey\lib'
    (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
  A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
    and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.
  
  Creating Chocolatey folders if they do not already exist.
  
  WARNING: You can safely ignore errors related to missing log files when
    upgrading from a version of Chocolatey less than 0.9.9.
    'Batch file could not be found' is also safe to ignore.
    'The system cannot find the file specified' - also safe.
  chocolatey.nupkg file not installed in lib.
   Attempting to locate it from bootstrapper.
  PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
  WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\###\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
  Chocolatey (choco.exe) is now ready.
  You can call choco from anywhere, command line or powershell by typing choco.
  Run choco /? for a list of functions.
  You may need to shut down and restart powershell and/or consoles
   first prior to using choco.
  Ensuring Chocolatey commands are on the path
  Ensuring chocolatey.nupkg is in the lib folder
  
  C:\WINDOWS\system32&gt;
  </code></pre>
  <p><strong>Then I ran <code>chocolatey install jq</code> and successfully install it:</strong></p>
  <p><strong>My <code>jq</code> installation output:</strong></p>
  <pre><code>    C:\WINDOWS\system32&gt;chocolatey install jq
  Chocolatey v0.10.15
  Installing the following packages:
  jq
  By installing you accept licenses for the packages.
  Progress: Downloading jq 1.6... 100%
  
  jq v1.6 [Approved]
  jq package files install completed. Performing other installation steps.
  The package jq wants to run 'chocolateyinstall.ps1'.
  Note: If you don't run this script, the installation will fail.
  Note: To confirm automatically next time, use '-y' or consider:
  choco feature enable -n allowGlobalConfirmation
  Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y
  
  Downloading jq 64 bit
    from 'https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe'
  Progress: 100% - Completed download of C:\ProgramData\chocolatey\lib\jq\tools\jq.exe (3.36 MB).
  Download of jq.exe (3.36 MB) completed.
  Hashes match.
  C:\ProgramData\chocolatey\lib\jq\tools\jq.exe
   ShimGen has successfully created a shim for jq.exe
   The install of jq was successful.
    Software install location not explicitly set, could be in package or
    default install location if installer.
  
  Chocolatey installed 1/1 packages.
   See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
  </code></pre>
  <p><strong>I then ran the your <code>@pierpy</code> youtube-dl command:</strong></p>
  <pre><code>youtube-dl --skip-download --print-json https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD | jq '{&quot;date&quot;: .upload_date,&quot;title&quot;: .title,&quot;URL&quot;: .url,&quot;duration&quot;: .duration}'
  </code></pre>
  <p><strong>and got a syntax error, with this output:</strong></p>
  <pre><code>    Microsoft Windows [Version 10.0.19042.867]
  (c) 2020 Microsoft Corporation. All rights reserved.
  
  C:\Users\###&gt;cd documents
  
  C:\Users\###\Documents&gt;cd youtube-dl
  
  C:\Users\###\Documents\youtube-dl&gt;youtube-dl --skip-download --print-json https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD | jq '{&quot;date&quot;: .upload_date,&quot;title&quot;: .title,&quot;URL&quot;: .url,&quot;duration&quot;: .duration}'
  jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Windows cmd shell quoting issues?) at &lt;top-level&gt;, line 1:
  '{date:
  jq: 1 compile error
  Traceback (most recent call last):
    File &quot;__main__.py&quot;, line 19, in &lt;module&gt;
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\__init__.py&quot;, line 475, in main
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\__init__.py&quot;, line 465, in _real_main
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 2060, in download
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 799, in extract_info
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 806, in wrapper
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 838, in __extract_info
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 924, in process_ie_result
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 1058, in __process_playlist
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 806, in wrapper
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 1068, in __process_iterable_entry
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 910, in process_ie_result
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 872, in process_ie_result
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 1683, in process_video_result
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 1793, in process_info
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 1765, in __forced_printings
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 520, in to_stdout
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\YoutubeDL.py&quot;, line 509, in _write_string
    File &quot;C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwt56m8wg\build\youtube_dl\utils.py&quot;, line 3180, in write_string
  OSError: [Errno 22] Invalid argument
  
  C:\Users\###\Documents\youtube-dl&gt;
  </code></pre>
  <p><strong>I then googled the error</strong></p>
  <p><code>jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Windows cmd shell quoting issues?)</code></p>
  <p><strong>and found insight from this suggestion:</strong></p>
  <p><a href="https://github.com/stedolan/jq/issues/392#issuecomment-45497322" rel="nofollow noreferrer">It's all about the quoting</a></p>
  <p><strong>I then accordingly adapted your <code>@pierpy</code> youtube-dl command single wrapping quotes to double quotes:</strong></p>
  <pre><code>youtube-dl --skip-download --print-json https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD | jq &quot;{&quot;date&quot;: .upload_date,&quot;title&quot;: .title,&quot;URL&quot;: .url,&quot;duration&quot;: .duration}&quot;
  </code></pre>
  <p><strong>Now it outputs the data <code>Upload Dates</code>, <code>Titles</code>, <code>URLs</code> and <code>Durations</code> just as needed.</strong></p>
  <p><strong>The final Output:</strong></p>
  <pre><code>C:\Users\###\Documents\youtube-dl&gt;youtube-dl --skip-download --print-json https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD | jq &quot;{&quot;date&quot;: .upload_date,&quot;title&quot;: .title,&quot;URL&quot;: .url,&quot;duration&quot;: .duration}&quot;
  {
    &quot;date&quot;: &quot;20150717&quot;,
    &quot;title&quot;: &quot;3.1: Flow (setup and draw) - Processing Tutorial&quot;,
    &quot;URL&quot;: &quot;https://r1---sn-n0ogpnx-b85s.googlevideo.com/videoplayback?expire=1617730292&amp;ei=lEZsYKDoEZmAp-oP3ayk8AI&amp;ip=188.154.162.181&amp;id=o-AHFxnOR5c5xqmgtu1JG4FbL6lJW0gz1pJQN77cr2-27T&amp;itag=22&amp;source=youtube&amp;requiressl=yes&amp;mh=m6&amp;mm=31%2C29&amp;mn=sn-n0ogpnx-b85s%2Csn-1gieen7e&amp;ms=au%2Crdu&amp;mv=m&amp;mvi=1&amp;pl=23&amp;initcwndbps=1578750&amp;vprv=1&amp;mime=video%2Fmp4&amp;ns=r3pR-nwt6FkDQa33iQQu-qgF&amp;ratebypass=yes&amp;dur=944.007&amp;lmt=1607684088067796&amp;mt=1617708538&amp;fvip=5&amp;fexp=24001373%2C24007246&amp;beids=9466585&amp;c=WEB&amp;txp=5432434&amp;n=3P6HQoLfY8ktFLG5&amp;sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cratebypass%2Cdur%2Clmt&amp;sig=AOq0QJ8wRgIhAMiNOv8QDjfsn7yxicEOtSjcEYjZlX3CfrI8D-HGBd63AiEA4E6rKv_kYti6rAeieJzPAdTYjoh05Az_11Kcxt-0jBg%3D&amp;lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&amp;lsig=AG3C_xAwRAIgD43F71OxMExfQyN9FeNWfZX_aiGAD3SKlKOLNR14NT8CICEuD_Ry0oymKZmFfHuP4F6v9MKCrmRI0x27sLG8fvyG&quot;,
    &quot;duration&quot;: 944
  }
  {
    &quot;date&quot;: &quot;20150717&quot;,
    &quot;title&quot;: &quot;3.2: Built-in Variables (mouseX, mouseY) - Processing Tutorial&quot;,
    &quot;URL&quot;: &quot;https://r4---sn-n0ogpnx-b85l.googlevideo.com/videoplayback?expire=1617730293&amp;ei=lEZsYMO2OczSWaPiueAC&amp;ip=188.154.162.181&amp;id=o-ANuT73vsKQLvQqynOeh00stVP-zqbq3x-iUrdDiYwg8E&amp;itag=22&amp;source=youtube&amp;requiressl=yes&amp;mh=kE&amp;mm=31%2C29&amp;mn=sn-n0ogpnx-b85l%2Csn-1gieen7e&amp;ms=au%2Crdu&amp;mv=m&amp;mvi=4&amp;pl=23&amp;initcwndbps=1617500&amp;vprv=1&amp;mime=video%2Fmp4&amp;ns=tPtC_l82gq-yi-rk_oQXatAF&amp;cnr=14&amp;ratebypass=yes&amp;dur=814.207&amp;lmt=1551720899437893&amp;mt=1617708538&amp;fvip=5&amp;fexp=24001373%2C24007246&amp;beids=9466585&amp;c=WEB&amp;txp=5432432&amp;n=LhJHXWU8TGNOrD9u&amp;sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Ccnr%2Cratebypass%2Cdur%2Clmt&amp;sig=AOq0QJ8wRAIgSHTlBPN0j49hoB02SYDeF3-9fe1iSz1KRiv9iFy8nj0CIHEafdAOBefsos8kO5FGhDljsKpOV7ZQ9dY1BEzQQ0n0&amp;lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&amp;lsig=AG3C_xAwRgIhAJkd-9posqapJekca_35YNG0g3nLgxTfW06EqRM-a3wDAiEApSrsS5wPlMPXjlI_bvOh53cjxlrHfNSKD4XbhyDyZ6w%3D&quot;,
    &quot;duration&quot;: 815
  }
  {
    &quot;date&quot;: &quot;20150717&quot;,
    &quot;title&quot;: &quot;3.3: Events (mousePressed, keyPressed) - Processing Tutorial&quot;,
    &quot;URL&quot;: &quot;https://r4---sn-n0ogpnx-b85l.googlevideo.com/videoplayback?expire=1617730293&amp;ei=lUZsYK6WJ4TeWaeflbgF&amp;ip=188.154.162.181&amp;id=o-AD1WgS46WiFogy00v3aHRp6aZXkd_ACN-_m76lPoQvA8&amp;itag=22&amp;source=youtube&amp;requiressl=yes&amp;mh=it&amp;mm=31%2C29&amp;mn=sn-n0ogpnx-b85l%2Csn-1gieen7e&amp;ms=au%2Crdu&amp;mv=m&amp;mvi=4&amp;pl=23&amp;initcwndbps=1617500&amp;vprv=1&amp;mime=video%2Fmp4&amp;ns=AlyS4uv2BH5ENfp_nP53I-sF&amp;cnr=14&amp;ratebypass=yes&amp;dur=441.225&amp;lmt=1472343659978757&amp;mt=1617708538&amp;fvip=4&amp;fexp=24001373%2C24007246&amp;beids=9466585&amp;c=WEB&amp;n=np6rmmeSKhYEvG1K&amp;sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Ccnr%2Cratebypass%2Cdur%2Clmt&amp;sig=AOq0QJ8wRgIhAIRmvxmY-VidN3LPhnzCNQ2TLsUB_7i1yU0QOMBVUS6AAiEAm9DE-Kk6cCNb8FC0we4c2O8299n2_2jGnQfzYzz0igo%3D&amp;lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&amp;lsig=AG3C_xAwRQIgZzrGEwMcb0Vrj9FleanW2apPMu_55OdH2SRdw66DQ1QCIQCDsAz7X5RxczKtWzokBhyUNcyXLXeZF-ENufpjA0BP2Q%3D%3D&quot;,
    &quot;duration&quot;: 442
  }
  
  C:\Users\###\Documents\youtube-dl&gt;
  </code></pre>
  <hr />
  <h2>LAST ISSUE:</h2>
  <hr />
  <p><strong>The gotten <code>URLs</code> don't display the standard video ones.
  Why not?</strong></p>
  <p><strong>In the <a href="https://github.com/ytdl-org/youtube-dl/#output-template" rel="nofollow noreferrer">Youtube-dl's GitHub Doc Used as reference</a> it states:</strong></p>
  <pre><code>url (string): Video URL
  </code></pre>
  <p><strong>How to retrieve the standard Youtube Video URLs?</strong></p>
  <h2><strong>LAST ISSUE ANSWER:</strong></h2>
  <p><strong>I just reviewed my <code>example.json</code> file generated yesterday and found out that the standard Youtube video URLs accepts <code>webpage_url</code> in place of <code>url</code>.</strong></p>
  <hr />
  <p><strong>FINAL YOUTUBE-DL OUTPUT:</strong></p>
  <hr />
  <pre><code>C:\Users\###\Documents\youtube-dl&gt;youtube-dl --skip-download --print-json https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD | jq &quot;{&quot;date&quot;: .upload_date,&quot;title&quot;: .title,&quot;URL&quot;: .webpage_url,&quot;duration&quot;: .duration}&quot;
  {
    &quot;date&quot;: &quot;20150717&quot;,
    &quot;title&quot;: &quot;3.1: Flow (setup and draw) - Processing Tutorial&quot;,
    &quot;URL&quot;: &quot;https://www.youtube.com/watch?v=o8dffrZ86gs&quot;,
    &quot;duration&quot;: 944
  }
  {
    &quot;date&quot;: &quot;20150717&quot;,
    &quot;title&quot;: &quot;3.2: Built-in Variables (mouseX, mouseY) - Processing Tutorial&quot;,
    &quot;URL&quot;: &quot;https://www.youtube.com/watch?v=ibW4oA7-n8I&quot;,
    &quot;duration&quot;: 815
  }
  {
    &quot;date&quot;: &quot;20150717&quot;,
    &quot;title&quot;: &quot;3.3: Events (mousePressed, keyPressed) - Processing Tutorial&quot;,
    &quot;URL&quot;: &quot;https://www.youtube.com/watch?v=UvSjtiW-RH8&quot;,
    &quot;duration&quot;: 442
  }
  
  C:\Users\###\Documents\youtube-dl&gt;
  </code></pre>
  <p><strong>TO GET THE FINAL OUTPUT IN A JSON FILE:</strong></p>
  <pre><code>youtube-dl --skip-download --print-json https://www.youtube.com/playlist?list=PLRqwX-V7Uu6by61pbhdvyEpIeymlmnXzD | jq &quot;{&quot;date&quot;: .upload_date,&quot;title&quot;: .title,&quot;URL&quot;: .webpage_url,&quot;duration&quot;: .duration}&quot; &gt; example.json
  </code></pre>