Passing the" video-Index " of a playlist in a YouTube iframe

I'm creating a site where I want to display the last two videos posted on a given channel, but I can't pass the parameters of index from the video through src from iframe as shown below:

<iframe 
  src="https://www.youtube.com/embed?listType=playlist&list=PLYFQKMIdrXSbuNYzQmrc8ocTdT6u4EZGe&index=0"
  frameborder="0" 
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" 
  allowfullscreen></iframe>

<iframe 
  src="https://www.youtube.com/embed?listType=playlist&list=PLYFQKMIdrXSbuNYzQmrc8ocTdT6u4EZGe&index=1" 
  frameborder="0" 
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" 
  allowfullscreen></iframe>

Can anyone help me with a possible solution to my problem?

Author: Icaro Martins, 2019-07-01

2 answers

Brother, if you put it like this you will see that it works.. the problem in your case is that the video with index = 1, is a private video or is broken and cannot be added to embed!

<iframe
  src="https://www.youtube.com/embed?listType=playlist&list=PLYFQKMIdrXSbuNYzQmrc8ocTdT6u4EZGe&index=0"
  frameborder="0"
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen></iframe>

<iframe
  src="https://www.youtube.com/embed?listType=playlist&list=PLYFQKMIdrXSbuNYzQmrc8ocTdT6u4EZGe&index=3"
  frameborder="0"
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen></iframe>
 1
Author: wDrik, 2019-07-01 18:02:13

I did it this way and it hadn't worked out, but I already did it... I will post the solution here in case anyone else looks for it:

//Último Vídeo postado no canal
<iframe src="https://www.youtube.com/embed/videoseries?list=[UPLOAD_PLAYLIST_ID]&index=0" frameborder="0" allowfullscreen></iframe>

//Penúltimo Vídeo postado no canal
<iframe src="https://www.youtube.com/embed/videoseries?list=[UPLOAD_PLAYLIST_ID]&index=1" frameborder="0" allowfullscreen></iframe>
 0
Author: Lucas Eduardo Calgaro, 2019-08-23 20:54:23