Skip to content

Instantly share code, notes, and snippets.

@alexwybraniec
Last active December 17, 2015 22:59
Show Gist options
  • Save alexwybraniec/5685651 to your computer and use it in GitHub Desktop.
Save alexwybraniec/5685651 to your computer and use it in GitHub Desktop.
Use the brilliant CasperJS (http://casperjs.org/) library to pulled down extended stats from Vimeo.
//You can grab these using the getUploaded API call
//https://developer.vimeo.com/apis/advanced/methods/vimeo.videos.getUploaded/playground
var vimeo_ids = [ 123, 456, 789 ];
var casper = require('casper').create();
casper.start('https://vimeo.com/log_in');
casper.then(function() {
casper.test.info('Load form');
this.fill('form#login_form', {
'email': 'you@yours.com',
'password': 'password123'
}, true);
});
//We have a PRO account, so this is a quick test to see if we've logged in properly
casper.waitUntilVisible('.badge_plus', function() {
casper.test.info('pro badge visible');
});
casper.each(vimeo_ids, function(self, vimeo_id) {
self.thenOpen('https://vimeo.com/stats/video/' + vimeo_id + '/totals/range:all', function() {
casper.test.info('Downloading ' + vimeo_id + ' CSV stats');
casper.download('https://vimeo.com/stats/video/' + vimeo_id + '/totals/export:csv', vimeo_id + '.csv');
});
});
casper.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment