title: list format for popen streamlink
body: <p>I am trying to run subprocess.popen with out the Shell=true, but can't figure out how to format my list. it will always fail with an invalid url or 403. Like it doesn't set the cookie or header.</p>
  
  <p>Example url</p>
  
  <pre><code>https://vodus-i-video-xxx.xxx.net/vodus/1d9cfcbc-8469-4c9f-b44a-6412091b733d/NoADs_IND_SEA_720_pre1.ism/QualityLevels(4740905)/Manifest(video,format=m3u8-aapl-v3,audiotrack=aac_UND_2_127,filter=chromecast)?hdnea=st=1535729260~exp=1535729440~acl=/*~hmac=977cba9e480bcdb7b89033488f37679b4a6906f8f7a981a055b88a0802012c71&amp;hdcore=2.11.3|Connection=keep-alive&amp;User-Agent=Firefox|Connection=keep-alive&amp;User-Agent=Firefox
  </code></pre>
  
  <p>I parse the url to get the cookie::</p>
  
  <pre><code>"hdnea=st=1535729260~exp=1535729440~acl=/*~hmac=977cba9e480bcdb7b89033488f37679b4a6906f8f7a981a055b88a0802012c71&amp;hdcore=2.11.3;path=/; domain=livemain-i-video-xxx.xxx.net;86400s"
  </code></pre>
  
  <p>final string which will work with Shell=true</p>
  
  <pre><code>streamlink --player-external-http --player-external-http-port 10000 --http-header "User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0" --http-cookie "hdnea=st=1535729260~exp=1535729440~acl=/*~hmac=977cba9e480bcdb7b89033488f37679b4a6906f8f7a981a055b88a0802012c71&amp;hdcore=2.11.3;path=/; domain=livemain-i-video-xxx.xxx.net;86400s" "hlsvariant://https://vodus-i-video-xxx.xxx.net/vodus/1d9cfcbc-8469-4c9f-b44a-6412091b733d/NoADs_IND_SEA_720_pre1.ism/QualityLevels(4740905)/Manifest(video,format=m3u8-aapl-v3,audiotrack=aac_UND_2_127,filter=chromecast)?hdnea=st=1535729260~exp=1535729440~acl=/*~hmac=977cba9e480bcdb7b89033488f37679b4a6906f8f7a981a055b88a0802012c71&amp;hdcore=2.11.3|Connection=keep-alive&amp;User-Agent=Firefox|Connection=keep-alive&amp;User-Agent=Firefox" best
  </code></pre>
  
  <p>This is how I tried to format but just can't seem to get it right.</p>
  
  <pre><code>stream_url="https://vodus-i-video-nfl.akamaized.net/vodus/1d9cfcbc-8469-4c9f-b44a-6412091b733d/NoADs_IND_SEA_720_pre1.ism/QualityLevels(4740905)/Manifest(video,format=m3u8-aapl-v3,audiotrack=aac_UND_2_127,filter=chromecast)?hdnea=st=1535729260~exp=1535729440~acl=/*~hmac=977cba9e480bcdb7b89033488f37679b4a6906f8f7a981a055b88a0802012c71&amp;hdcore=2.11.3|Connection=keep-alive&amp;User-Agent=Firefox|Connection=keep-alive&amp;User-Agent=Firefox"
  urlsplit = stream_url.split('?')
  getcookie = urlsplit[1].split('|')
  cookie = getcookie[0] 
  cmd = [
  "streamlink",
  "--player-external-http",
  "--player-external-http-port", 
  "%s" %(port),
  "--http-header",
  "\"User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0\"",
  "--http-cookie",
  "\"%s" %(cookie) + ";path=/;domain=livemain-i-video-nfl.akamaized.net;86400s\"",
  "%s" %(streamtest),   
  "best"
  ]
      logger.info("Running cmd: %s" % " ".join(cmd))
      proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      output, err = proc.communicate()
      logging.info(output)
  </code></pre>
  
  <p>Output i get is:</p>
  
  <blockquote>
    <p>INFO:root:Running cmd: streamlink --player-external-http --player-external-http-port 15000 --http-header "User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0" --http-cookie "hdnea=st=1535680989~exp=1535681169~acl=/*~hmac=0232a24cb481541387ff7984e7b78f44f6ccdf3d2893d8bbbe4eb7e44fe1baea&amp;hdcore=2.11.3;path=/;domain=livemain-i-video-xxx.xxx.net;86400s" hlsvariant://<a href="https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)" rel="nofollow noreferrer">https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)</a> best</p>
    
    <p>INFO:root:[cli][info] streamlink is running as root! Be careful!
    [cli][info] Found matching plugin hls for URL hlsvariant://<a href="https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)" rel="nofollow noreferrer">https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)</a>
    error: Unable to open URL: <a href="https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)" rel="nofollow noreferrer">https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)</a> (403 Client Error: Forbidden for url: <a href="https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)" rel="nofollow noreferrer">https://livemain-i-video-xxx.xxx.net/ch16/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd/7fd8a3f6-5dee-4ed1-b23f-7398684ff5bd.ism/QualityLevels(2200000)/Manifest(video,format=m3u8-aapl-v3,audiotrack=audio,filter=chromecast-live)</a>)</p>
  </blockquote>
  
  <p>What the join does looks correct, but just can't seem to get it right. I do think I need the double quotes for the cookie and url because of the special characters. Was just hoping to get an output and with Shell=True you don't get an output until its finished.  </p>