JS-151-API
  • JavaScript Library
  • 02-DOM-Manipulation
    • Overview
    • DOM Explained
    • Example Setup
    • Selecting Elements
    • Events
    • Complete Example
  • 03-API Fundamentals
    • 0-Getting Started
      • Welcome
    • 1-Intro-To-APIs
      • Intro
      • Client
      • Requests
      • JSON
      • API Endpoints
      • Server
      • Response
      • Statelessness
      • REST
    • 2-Asynchronous-Programming
      • Intro
      • Callbacks
      • Promises
      • Promises Continued
      • Chaining Promises
    • 3-Fetch
      • Fetch Intro
      • Star Wars
        • Star Wars API
        • Star Wars Setup
        • Star Wars JS
      • Random Photo
        • Unsplash
        • Unsplash Setup
        • Unsplash JS
    • 4-Apps
      • 01-New York Times
        • 00-App Intro
        • 01-HTML/CSS/API Key
        • 02-Variables
        • 03-Event Listeners
        • 04-fetchResults
          • 01-fetchResults()
          • 02-preventDefault()
          • 03-fetch() method
          • 04-Dates
        • 05-displayResults
          • 01-Logging JSON
          • 02-Working with JSON
          • 03-Link Display
          • 04-Results Navigation
          • 05-Results Update
          • 06-Keywords
          • 07-Images
        • 06-Pagination
          • 01-Pagination Intro
          • 02-Pagination Functions
        • 07-Next Steps
      • 02-YouTube
        • html
        • youtube.css
        • youtube.js
      • 03-GoogleMaps
        • Setup
        • HTML and CSS files
        • API Key
        • JS Setup
        • Adding Your Location
        • Listeners
        • Custom Options
Powered by GitBook
On this page
  1. 03-API Fundamentals
  2. 4-Apps
  3. 02-YouTube

html

Make this your index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>YouTube APIs example</title>
    <link href="youtube.css" rel="stylesheet">
  </head>
  <body>
    <h1>YouTube video search</h1>

    <div class="wrapper">

      <div class="controls">
        <form>
          <p>
            <label for="search">Enter a search term (required): </label>
            <input type="text" id="search" class="search" required>
          </p>
          <p>
            <button class="submit">Submit search</button>
          </p>
        </form>
      </div>

      <div class="results">
        <section>
        </section>
      </div>

    </div>

    <!--
      Apply both necessary API scripts to your HTML. The first is for the YouTube Data
      API, and the second is for the YouTube Iframe Player API
    -->
    <script src="https://apis.google.com/js/client.js" type="text/javascript"></script>
    <script src="https://www.youtube.com/iframe_api" type="text/javascript"></script>
    <script type="text/javascript" src="youtube.js"></script>
  </body>
</html>
Previous02-YouTubeNextyoutube.css

Last updated 6 years ago