Skip to content

Instantly share code, notes, and snippets.

@ivansabik
Created October 10, 2015 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivansabik/05d7107c4026eec024cb to your computer and use it in GitHub Desktop.
Save ivansabik/05d7107c4026eec024cb to your computer and use it in GitHub Desktop.
Scrape soundcloud playlist with casperjs and slimerjs then save to text file
var casper = require('casper').create();
var fs = require('fs');
casper.start('https://soundcloud.com/vlad-gonta/sets/new-1', function() {
this.viewport(768, 10000);
}).then(function () {
this.scrollToBottom();
this.wait(1000);
}).then(function () {
this.scrollToBottom();
this.wait(500);
}).then(function () {
this.scrollToBottom();
this.wait(500);
}).then(function () {
this.scrollToBottom();
this.wait(500);
}).then(function () {
this.scrollToBottom();
console.log('Writing to file');
fs.write('/tmp/soundcloud.html', this.getHTML());
this.capture('/tmp/soundcloud.png');
})
casper.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment