Questions tagged [youtube-api]

The YouTube APIs and Tools enable the integration of YouTube's video content and functionality into a website, application, or device.

YouTube API

The API refers to the collection of APIs which are used for embedding YouTube videos and content into an application.

References

11465 questions
2775
votes
31 answers

How do I get a YouTube video thumbnail from the YouTube API?

If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?
CodeOverload
  • 47,274
  • 54
  • 131
  • 219
615
votes
6 answers

Access variables and functions defined in page context using a content script

I'm learning how to create Chrome extensions. I just started developing one to catch YouTube events. I want to use it with YouTube flash player (later I will try to make it compatible with HTML5). manifest.json: { "name": "MyExtension", …
309
votes
20 answers

YouTube API to fetch all videos on a channel

We need a video list by channel name of YouTube (using the API). We can get a channel list (only channel name) by using the below API: https://gdata.youtube.com/feeds/api/channels?v=2&q=tendulkar Below is a direct link of…
Rajendra Dewani
  • 3,281
  • 3
  • 15
  • 8
264
votes
11 answers

What is the purpose of a "Refresh Token"?

I have a program that integrates with the YouTube Live Streaming API. It runs on timers, so its been relatively easy for me to program in to fetch a new Access Token every 50 minutes with a Refresh Token. My question is, why? When I authenticated…
259
votes
16 answers

How to embed an autoplaying YouTube video in an iframe?

I am trying to embed the new iframe version of a YouTube video and get it to auto play. As far as I can tell, there is no way of doing this by amending flags to the URL. Is there a way to do it by using JavaScript & the API?
472084
  • 17,666
  • 10
  • 63
  • 81
250
votes
5 answers

Embed YouTube video - Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

I am trying to feed my Django page with some resource I am getting from somewhere else. Inside the feed, I have YouTube videos with URL like: https://www.youtube.com/watch?v=A6XUVjK9W4o Once I added this into my page, the video does not show up,…
doniyor
  • 36,596
  • 57
  • 175
  • 260
244
votes
29 answers

Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000

This is the error message that I get: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:9000'). I've seen other similar problems…
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
198
votes
13 answers

How can I autoplay a video using the new embed code style for Youtube?

I can't work out how to autoplay a video using the new embed code style for Youtube. I tried adding &autoplay=1 to the url, which worked with the old style, but it didn't work. For example, http://www.youtube.com/embed/JW5meKfy3fY is the embed link,…
ben
  • 29,229
  • 42
  • 124
  • 179
165
votes
7 answers

YouTube iframe API: how do I control an iframe player that's already in the HTML?

I want to be able to control iframe based YouTube players. This players will be already in the HTML, but I want to control them via the JavaScript API. I've been reading the documentation for the iframe API which explain how to add a new video to…
agente_secreto
  • 7,959
  • 16
  • 57
  • 83
157
votes
11 answers

Why am I seeing an "origin is not allowed by Access-Control-Allow-Origin" error here?

I am seeing the following error: Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin with this code: var http = new getXMLHttpRequestObject(); var url = "http://gdata.youtube.com/action/GetUploadToken"; var sendXML = '
Muhammad Usman
  • 10,426
  • 22
  • 72
  • 107
154
votes
22 answers

How can I get a channel ID from YouTube?

I'm trying to retrive the data from my channel using the YouTube Data API V3. For that I need my channel ID. I've tried to find my channel ID from my YouTube account, and I failed in every single way. If anyone have a single tip for me, I would be…
klauskpm
  • 2,965
  • 2
  • 18
  • 29
113
votes
7 answers

How do I get video durations with YouTube API version 3?

I'm using YouTube API v3 to search YouTube. https://developers.google.com/youtube/v3/docs/search As you can see, the response JSON doesn't contains video durations. Is there way to get video durations? Preferably not calling an API for each element…
Rukshan
  • 7,902
  • 6
  • 43
  • 61
91
votes
15 answers

How to get number of video views with YouTube API?

The question is very simple. How to get number of video views with YouTube API? The task is simple but I would like to use that query on large number of videos very often. Is there any way to call their Youtube API and get it? (something like…
Ante
  • 8,567
  • 17
  • 58
  • 70
89
votes
14 answers

How to pause a YouTube player when hiding the iframe?

I have a hidden div containing a YouTube video in an