Created
October 18, 2018 10:56
-
-
Save getjump/a4c76bc7198ebf8e8fb5700026b0f9d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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