🌐
Google
developers.google.com › youtube › data api › api reference
API Reference | YouTube Data API | Google for Developers
This reference guide explains how to use the API to perform all of these operations. The guide is organized by resource type. A resource represents a type of item that comprises part of the YouTube experience, such as a video, a playlist, or a subscription. For each resource type, the guide lists one or more data representations, and resources are represented as JSON objects.
🌐
Google
developers.google.com › youtube › data api › youtube data api overview
YouTube Data API Overview | Google for Developers
The part parameter is mandatory for retrieving resources and specifies which properties to include, while the fields parameter further filters the response, reducing data transfer by omitting unnecessary nested properties. Performance optimizations include the use of ETags for caching and overwrite protection, and gzip compression to reduce bandwidth usage. This document is intended for developers who want to write applications that interact with YouTube. It explains basic concepts of YouTube and of the API itself.
🌐
Medium
medium.com › @kattia.marin › how-to-use-the-youtube-data-api-v3-ad24b26d447d
How to Use the YouTube Data API v3 | by Kattia Marin | Medium
January 30, 2025 - The API returns JSON data and supports GET/POST requests. Here’s how to retrieve video metadata using Python: ... API_KEY = 'YOUR_API_KEY' youtube = build('youtube', 'v3', developerKey=API_KEY)# Get video details def get_video_details(video_id): request = youtube.videos().list( part="snippet,statistics", id=video_id ) response = request.execute() return responsevideo_id = "VIDEO_ID_HERE" video_data = get_video_details(video_id) print(video_data)
🌐
Google
developers.google.com › youtube › data api › youtube data api (v3) code samples
YouTube Data API (v3) Code Samples | Google for Developers
Explore the use cases and code samples page to find examples for the YouTube Data API and YouTube Live Streaming API.
🌐
Google
developers.google.com › youtube › data api
YouTube Data API | Google for Developers
With the YouTube Data API, you can add a variety of YouTube features to your application.
🌐
Medium
medium.com › mcd-unison › youtube-data-api-v3-in-python-tutorial-with-examples-e829a25d2ebd
YouTube Data API v3 in Python: Tutorial with examples | by Pedro Hernández | MCD-UNISON | Medium
September 8, 2021 - YouTube Data API v3 tutorial in Python. Examples of how to retrieve videos details and chat messages from live broadcasts are provided.
🌐
Apidog
apidog.com › blog › youtube-api
YouTube Data API Overview | How to Implement it in Your Applications
July 26, 2025 - YouTube Data API (v3) - Quota Calculator | Google for Developers
🌐
YouTube
youtube.com › watch
YouTube Data API v3 Tutorial - YouTube
Twitter: https://twitter.com/ansonthedevGithub: https://github.com/stuyyDiscord: https://discord.gg/ansonBuy Me a Ko-fi: http://ko-fi.com/ansonMY RESOURCES:L...
Published   May 1, 2020
Find elsewhere
🌐
GitHub
github.com › happycod3r › YouTube-Data-API-v3-Tools
GitHub - happycod3r/YouTube-Data-API-v3-Tools: A comprehensive YouTube Data API v3 wrapper library used to easily integrate YouTube functionality into any project.
The YouTube Data API v3 Tools Library is a concise wrapper around the YouTube API. The YouTubeDataAPIv3Tools class and sub-classes contain hundreds of methods to interact with YouTube.
Starred by 11 users
Forked by 5 users
Languages   Python
🌐
Google
developers.google.com › youtube › data api › implementation guide
Implementation Guide | YouTube Data API | Google for Developers
This series of guides explains how to use the YouTube Data API (v3) to perform many different types of functions.
🌐
W3Things
w3things.com › blog › youtube-data-api-v3-fetch-video-data-nodejs
YouTube Data API v3 — Fetch Video Data Using Node.js
March 5, 2025 - Learn how to fetch YouTube video data using YouTube Data API v3 in Node.js. Understand the YouTube API response and more.
🌐
Readthedocs
youtube-data-api.readthedocs.io › en › latest › youtube_api.html
API Guide — youtube-data-api 0.0.17 documentation
Read the docs: https://developers.google.com/youtube/v3/docs/playlists/list · get_videos_from_playlist_id(playlist_id, next_page_token=None, parser=<function parse_video_url>, part=['snippet'], max_results=200000, **kwargs)[source]¶ · Given a playlist_id, returns video_ids associated with that playlist. Note that user uploads for any given channel are from a playlist named “upload playlist id”. You can get this value using youtube_api.youtube_api.get_channel_metadata() or youtube_api.youtube_api_utils.get_upload_playlist_id().
🌐
HubSpot
blog.hubspot.com › website › how-to-get-youtube-api-key
How to get a YouTube API key [tutorial + examples]
September 23, 2025 - If we want to connect our website or app to YouTube using code, whether you’re working in Java, JavaScript, PHP, Python, or even curl, the YouTube Data API v3 documentation offers a rich library of customizable code samples to help us get started quickly.
🌐
RapidAPI
rapidapi.com › ytdlfree › api › youtube-v31
Youtube v3
Without any api key use YT api v3 functionalities through our api. Just follow the YT api v3 docs and send same parameters to our service, get same response. For custom plan, please contact us. For quick chat: https://t.me/api_chat_support
🌐
Google
googleapis.dev › ruby › google-api-client › latest › Google › Apis › YoutubeV3.html
Module: Google::Apis::YoutubeV3 — Documentation by YARD 0.9.26
generated/google/apis/youtube_v3.rb, generated/google/apis/youtube_v3/classes.rb, generated/google/apis/youtube_v3/service.rb, generated/google/apis/youtube_v3/representations.rb ... The YouTube Data API v3 is an API that provides access to YouTube data, such as videos, playlists, and channels.
🌐
DZone
dzone.com › coding › frameworks › youtube data api (v3): introduction with spring boot
YouTube Data API (v3): Introduction With Spring Boot
September 17, 2019 - In this tutorial, we are introduced to the YouTube Data API where we tackle basic app development using this API, Spring Boot, Hibernate JPA, and Gradle.
🌐
W3Resource
w3resource.com › API › youtube › tutorial.php
YouTube API Tutorial | w3resource
This tutorial demonstrate how to use YouTube API v3 to search and watch videos from YouTube.
Top answer
1 of 3
23

You don't have to use the iOS client Google provides to make those kinds of request.

  1. Navigate to the API Console and generate a new Simple API Access key for your iOS application. Be sure to enter your app's bundle identifier in the provided window. Alternatively, you can create a Server API key for testing with basic requests and curl from the command line.

  2. Find the relevant endpoint for your needs. To find information about a video, you'll want to use the Videos.list method.

First, set up you URL. I will be using this URL as an example: https://www.youtube.com/watch?v=AKiiekaEHhI

You're going to want to specify a value for the part parameter. From your question, it looks like you're going to want to pass in the snippet, contentDetails, and statistics values (although for likes and views, you really only need the statistics value).

Then pass in the id of your video (in this case AKiiekaEHhI, you can add up to 50 comma-separated IDs) and your API key. Your URL should look something like this :

https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2C+snippet%2C+statistics&id=AKiiekaEHhI&key={YOUR_API_KEY}

You can also do this in the API Explorer.

Swift implementation:

// Set up your URL
let youtubeApi = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2C+snippet%2C+statistics&id=AKiiekaEHhI&key={YOUR_API_KEY}"
let url = NSURL(string: youtubeApi)

// Create your request
let task = NSURLSession.sharedSession().dataTaskWithURL(url!, completionHandler: { (data, response, error) -> Void in
    do {
        if let jsonResult = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.AllowFragments) as? [String : AnyObject] {

            print("Response from YouTube: \(jsonResult)")
        }
    }
    catch {
        print("json error: \(error)")
    }

})

// Start the request
task.resume()

Objective-C implementation:

(This post has been edited to support NSURLSession. For an implementation that uses NSURLConnection, check the edit history)

// Set up your URL
NSString *youtubeApi = @"https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2C+snippet%2C+statistics&id=AKiiekaEHhI&key={YOUR_API_KEY}";
NSURL *url = [[NSURL alloc] initWithString:youtubeApi];

// Create your request
NSURLRequest *request = [NSURLRequest requestWithURL:url];

// Send the request asynchronously
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *connectionError) {

    // Callback, parse the data and check for errors
    if (data && !connectionError) {
        NSError *jsonError;
        NSDictionary *jsonResult = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&jsonError];

        if (!jsonError) {
            NSLog(@"Response from YouTube: %@", jsonResult);
        }
    }
}] resume];

Your log will look something like this:

Response from YouTube: {
    etag = "\"NO6QTeg0-3ShswIeqLchQ_mzWJs/AAjIATmVK_8ySsAWwEuNfdZdjW4\"";
    items =     (
                {
            contentDetails =             {
                caption = false;
                definition = hd;
                dimension = 2d;
                duration = PT17M30S;
                licensedContent = 1;
            };
            etag = "\"NO6QTeg0-3ShswIeqLchQ_mzWJs/8v8ee5uPZQa1-ucVdjBdAVXzcZk\"";
            id = AKiiekaEHhI;
            kind = "youtube#video";
            snippet =             {
                categoryId = 20;
                channelId = UCkvdZX3SVgfDW8ghtP1L2Ug;
                channelTitle = "Swordless Link";
                description = "Follow me on Twitter! http://twitter.com/swordlesslink\n\nFollow me on TwitchTV for live video game streaming! http://twitch.tv/swordlesslink";
                liveBroadcastContent = none;
                localized =                 {
                    description = "Follow me on Twitter! http://twitter.com/swordlesslink\n\nFollow me on TwitchTV for live video game streaming! http://twitch.tv/swordlesslink";
                    title = "The Legend of Zelda: Majora's Mask With Glitches - Part 17: Going Against the Flow";
                };
                publishedAt = "2015-05-04T10:01:43.000Z";
                thumbnails =                 {
                    default =                     {
                        height = 90;
                        url = "https://i.ytimg.com/vi/AKiiekaEHhI/default.jpg";
                        width = 120;
                    };
                    high =                     {
                        height = 360;
                        url = "https://i.ytimg.com/vi/AKiiekaEHhI/hqdefault.jpg";
                        width = 480;
                    };
                    medium =                     {
                        height = 180;
                        url = "https://i.ytimg.com/vi/AKiiekaEHhI/mqdefault.jpg";
                        width = 320;
                    };
                    standard =                     {
                        height = 480;
                        url = "https://i.ytimg.com/vi/AKiiekaEHhI/sddefault.jpg";
                        width = 640;
                    };
                };
                title = "The Legend of Zelda: Majora's Mask With Glitches - Part 17: Going Against the Flow";
            };
            statistics =             {
                commentCount = 54;
                dislikeCount = 3;
                favoriteCount = 0;
                likeCount = 265;
                viewCount = 6356;
            };
        }
    );
    kind = "youtube#videoListResponse";
    pageInfo =     {
        resultsPerPage = 1;
        totalResults = 1;
    };
} with error: nil

The object for the items key will be an array of info for each video id you passed in to the request.

By digging into this response, you will be able to get the information you need. For example:

if let items = jsonResult["items"] as? [AnyObject]? {
    println(items?[0]["statistics"])
}

Will give you a dictionary of the video's statistics (where you can get the number of likes and the number of views).

{
    commentCount = 54;
    dislikeCount = 3;
    favoriteCount = 0;
    likeCount = 265;
    viewCount = 6356;
}

This same approach can be used with live events.

2 of 3
7

// Swift 3

func search() {


   let videoType = "video you want to search"

    // can use any text


    var dataArray = [[String: AnyObject]]()
    // store videoid , thumbnial , Title , Description

    var apiKey = "_________________"

     // create api key from google developer console for youtube



        var urlString = "https://www.googleapis.com/youtube/v3/search?part=snippet&q=\(videoType)&type=video&videoSyndicated=true&chart=mostPopular&maxResults=10&safeSearch=strict&order=relevance&order=viewCount&type=video&relevanceLanguage=en&regionCode=GB&key=\(apiKey)"



        urlString = urlString.addingPercentEncoding( withAllowedCharacters: .urlQueryAllowed)!
        let targetURL = URL(string: urlString)

        let config = URLSessionConfiguration.default // Session Configuration
        let session = URLSession(configuration: config)

        let task = session.dataTask(with: targetURL!) {

            data, response, error in


            if error != nil {

                print(error!.localizedDescription)


                var alert = UIAlertView(title: "alert", message: "No data.", delegate: nil, cancelButtonTitle: "OK")
                alert.show()



                return

            }

            else {




                do {





                    typealias JSONObject = [String:AnyObject]

                    let  json = try JSONSerialization.jsonObject(with: data!, options: []) as! JSONObject
                    let items  = json["items"] as! Array<JSONObject>



                    for i in 0 ..< items.count {

                        let snippetDictionary = items[i]["snippet"] as! JSONObject
                        print(snippetDictionary)
                        // Initialize a new dictionary and store the data of interest.
                        var youVideoDict = JSONObject()

                        youVideoDict["title"] = snippetDictionary["title"]
                        youVideoDict["channelTitle"] = snippetDictionary["channelTitle"]
                        youVideoDict["thumbnail"] = ((snippetDictionary["thumbnails"] as! JSONObject)["high"] as! JSONObject)["url"]
                        youVideoDict["videoID"] = (items[i]["id"] as! JSONObject)["videoId"]






                        dataArray.append(youVideoDict)


                       print(dataArray)



                        // video like can get by videoID.




                    }


                }

                catch {
                    print("json error: \(error)")
                }

            }
        }
        task.resume()









}