-
-
Save vijayrudraraju/ab198364f4ecd6689ed4 to your computer and use it in GitHub Desktop.
Scrape Facebook with CasperJS
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
casper = require('casper').create() | |
casper.start "https://facebook.com", -> | |
query = | |
email: 'youremail' | |
pass: 'yourpass' | |
@fill "#login_form", query, true | |
casper.thenOpen 'https://facebook.com/username' | |
casper.then -> | |
tryAndScroll = -> | |
casper.waitFor -> | |
casper.scrollToBottom() | |
true | |
, -> | |
unless casper.visible '.createdAccountUnit' | |
tryAndScroll() | |
tryAndScroll() | |
casper.then -> | |
elements = JSON.stringify @getElementsInfo('.userContent') | |
require('fs').write('user_content.json', elements) | |
casper.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment