Last active
December 17, 2015 22:59
-
-
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.
This file contains hidden or 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
//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': '[email protected]', | |
'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