Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fetch YouTube video_id directly after API update #29

Closed
wants to merge 1 commit into from

2 participants

@dbarlett

Google has removed getVideoData from the YouTube API. This commit fetches it from the object directly. Parsing it from getVideoUrl() may be a more stable long-term option.

@eduardocereto

I'm not sure using an undocumented api function to fix a bug introduced because I used an undocumented function is a good idea here. Specially because 'd' is probably a minified variable that could change on the next release.

@dbarlett

Good point. I'll fetch it another way.

@dbarlett dbarlett closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/plugins/youtube.js
View
4 src/plugins/youtube.js
@@ -24,7 +24,7 @@ var _ytPoolMaps = {};
function _ytStartPool(target) {
if (_ytTimeTriggers && _ytTimeTriggers.length) {
- var h = target['getVideoData']()['video_id'];
+ var h = target['d']['videoData']['video_id'];
if (_ytPoolMaps[h]) {
_ytStopPool(target);
}else {
@@ -54,7 +54,7 @@ function _ytPool(target, hash) {
}
function _ytStopPool(target) {
- var h = target['getVideoData']()['video_id'];
+ var h = target['d']['videoData']['video_id'];
if (_ytPoolMaps[h] && _ytPoolMaps[h].timer) {
_ytPool(target, h); // Pool one last time before clearing it.
clearTimeout(_ytPoolMaps[h].timer);
Something went wrong with that request. Please try again.