title: Retrieving a JSON from a youtube URL
body: <p>I was looking for a way to get a youtube video duration without using the API. Checking their HTML source, I see there is a javascript var called ytplayer.config (JSON with info about the video). How can I get that JSON to parse in a script?</p>
  
  <p>Thank you</p>
  
  <p>Edit. This is the var</p>
  
  <pre><code>ytplayer.config = {
      "assets": {
          "js": "\/\/s.ytimg.com\/yts\/jsbin\/player-es_MX-vfl0Fpy-X\/base.js",
          "css": "\/\/s.ytimg.com\/yts\/cssbin\/www-player-2x-webp-vflCn1Mkc.css"
      },
  
      ...
      ...
  
      "args": {
          "vm": "CAEQAA",
          "cl": "115273808",
          "iv_invideo_url": "https:\/\/www.youtube.com\/annotations_invideo?cap_hist=1\u0026video_id=tRY6WtFVtVY",
          "tmi": "1",
          "no_get_video_log": "1",
          "host_language": "es-419",
          "keywords": "Jorge,Lanata,TN,periodismo",
          "author": "Tribuna de Periodistas",
  
           ...
  
          "length_seconds": "130",
  
           ...
  
      }
  };
  </code></pre>