-3
  • I want to have multiple YouTube links that update on the same page(one video at at time). For example, in the HTML code below there is a link for the first page and the second page. The YouTube video that is in the first page is different than the one that is in the second page. This means that I need to create an HTML file for each video. How can I create one HTML page that can update multiple YouTube video links on the same web-page without creating an HTML file for each YouTube video?

<!DOCTYPE html>
        <html lang="en">
        <head>
        <meta charset="UTF-8">
        </head>
        <body>

    <a href="test.html">First Video</a>
    <a href="test.html">Second Video</a>

        <!-- This is the first video -->
        <iframe width="560" height="315"
                src="https://www.youtube.com/embed/621IukZrGJo?list=PLLcHY_4gyFEHRwJ8OuXjR3SjBazaEgoTq"
                frameborder="0" allowfullscreen>
        </iframe>

    <!-- This is the second video -->

    <iframe width="560" height="315"
                src="https://www.youtube.com/embed/H_sYWYq9Aks?list=PLLcHY_4gyFEHRwJ8OuXjR3SjBazaEgoTq"
                frameborder="0"
                allowfullscreen>
        </iframe> 
</body>
</html> 
Mohammad Mahjoub
  • 417
  • 4
  • 12
  • You probably need to implement the YouTube API into your backend/application - https://developers.google.com/youtube/v3/docs/videos/list – Aziz May 19 '17 at 03:02

2 Answers2

2

You have to use YouTube developer api. You can use JavaScript

https://developers.google.com/youtube/v3/code_samples/javascript

karthick
  • 11,998
  • 6
  • 56
  • 88
1
  1. linking Youtube channel to Website

Information for linking your youtube channel to your website can be found in this help article. You basically have to verify ownership through the Google Search Console, and when complete you will be able to link to your website through end cards and on your channel page.

  1. Display all videos on your channel on your website

There are a couple of ways. The first is explained in this SO answer and will embed all of your video's uploads.

  1. automatically updating your website's playlists when new videos are posted

It's automatic! An embed as shown in step 2 will always pull the latest version of a playlist when the page is loaded.

Community
  • 1
  • 1
Judge2020
  • 339
  • 4
  • 23
  • Just so you know, that solution will only work for channels with a legacy user name. If you don't have one, it will not work. So will depend on how old the channel is. If it is old enough and has a legacy name, then this would be the best ( simple ) option. Else it would need to use the api and do a GET on his channel every time the page loads. – Tempus May 19 '17 at 19:46
  • So, if I decided to do it the other way(using the api(what api?) and do a GET on his channel every time the page loads), then does that mean that I only need to implement HTML code? Please explain. – Mohammad Mahjoub May 21 '17 at 18:10
  • 1
    https://developers.google.com/youtube/v3/docs/playlists/list @MohammadMahjoub – Judge2020 May 21 '17 at 18:11
  • Is there any video that can demonstrates the process.This link seems very helpful, however, I still don't know how to use this documentation to build what I want to build. The api showed me what each method does, however, it doesn't tell how I can create one HTML page that has several YouTube links that link to the same page. What should I do?@Judge2020 – Mohammad Mahjoub May 21 '17 at 22:41