Skip to content

Instantly share code, notes, and snippets.

@getjump
Created October 18, 2018 10:56
Show Gist options
  • Save getjump/a4c76bc7198ebf8e8fb5700026b0f9d8 to your computer and use it in GitHub Desktop.
Save getjump/a4c76bc7198ebf8e8fb5700026b0f9d8 to your computer and use it in GitHub Desktop.
var data = [];
var job = function() {
$('span.title a').each(function(i, x) { data.push({name: x.innerText, link: $(x).attr('href'), vimeoId: '' })})
var w = window.open();
var i = 0;
var vimeoId = null;
var interval = setInterval(function() {
if (i >= data.length) {
clearInterval(interval);
return;
}
if (vimeoId == '') {
return;
}
var x = data[i];
w.location = [location.origin, x.link].join('');
var innerInterval = setInterval(function() {
if (!('$' in w)) {
return;
}
vimeoId = w.$('a.video-trigger').attr('data-vimeoid');
if (vimeoId) {
clearInterval(innerInterval);
}
}, 500);
console.log(vimeoId);
data[i].vimeoId = vimeoId;
++i;
vimeoId = '';
}, 1000);
//https://player.vimeo.com/video/274603371?autoplay=1&title=0&byline=0&portrait=0&color=ff9933&fullscreen=1&transparent=0
}
$(data).each(function(i, x) {
console.log(x.name, 'https://player.vimeo.com/video/' + x.vimeoId);
})
job();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment