What is API ?

  • API ( Application Programming Interface )
  • Protocol intended to be used as an interface by software components to communicate with each other
  • A set of routines, protocols, and tools for building software applications.
  • A good API makes it easier to develop a program by providing all the building blocks.

What is youtube API

  • The YouTube APIs and Tools let you bring the YouTube experience to your webpage, application, or device.
  • It is possible to search for videos, retrieve standard feeds, and see related content. A program can also authenticate as a user to upload videos, modify user playlists, and more

Youtube APIs

1. Player API player_apis

2 Data API

data_api

Different Versions

  • Version 1
  • Version 2 ( Recommended )
  • Version 3 ( Experimental )

API for android

YouTube Android Player API ( Experimental)
https://developers.google.com/youtube/android/player/

 

Youtube Data API

Search for Videos Search for Playlists Search for Channels

– Keywords (tags)
– Categories
– Query Params (metadata)

– Keywords (tags)
– Categories
– Keywords (tags)
– Categories

 

Retrieve

–Videos

–Comments

–Captions

–Related Videos

–Video Responses

–Categories

–Keywords

–Playlists

–Subscriptions

–Profiles

–Contacts

–Messages

–Activity Feeds

–Insight Data Feed

–Favorites

Create

–Videos

–Comments

–Captions

–Related Videos

–Video Responses

–Complaint

–Rating

–Contact

–Message

–Favorite

–Playlist

–Subscription

Update

–Video Metadata

–Captions

–Profiles

–Playlists

–Contacts

Delete

–Video

–Message

–Favorite

–Playlist

–Subscription

–Contact

Getting Youtube data

http://gdata.youtube.com/feeds/api/videos/VIDEO_ID?v=2&alt=json

 

Suppose you want to get data for the video:-

gangam video

 

For e.g.
http://gdata.youtube.com/feeds/api/videos/9bZkp7q19f0v=2&alt=json

alt => json or xml

Gives JSON Data as

 

{
    "version": "1.0",
    "encoding": "UTF-8",
    "entry": {
        "published": {
            "$t": "2012-07-15T07:46:32.000Z"
        },
        "title": {
            "$t": "PSY - GANGNAM STYLE (강남스타일) M/V"
        },
        "media$group": {
            "media$category": [
                {
                    "$t": "Music",
                    "label": "Music",
                    "scheme": "http://gdata.youtube.com/schemas/2007/categories.cat"
                }
            ],
           
"media$description": {
                "$t": "PSY - Gangnam Style (강남스타일) n App Store: http://goo.gl/l9TU6nGoogle Play: http://goo.gl/UiEn1nn© YG Entertainment Inc. All rights reserved.",
    },
            "yt$duration": {
                "seconds": "253"
            }
        },
        "yt$statistics": {
            "favoriteCount": "0",
            "viewCount": "1121801092"
        },
        "yt$rating": {
            "numDislikes": "523231",
            "numLikes": "6549910"
        }
    }
}

It gives more data than this. Yout get title, category, stats, ratings etc. I have tried to show you few of these.

 

For formatting json data:-

http://jsonlint.com

For more info
https://developers.google.com/youtube/