Commit f2d4dd2d f2d4dd2db3ce5777fc34081d3cf660f17c718fff by Narno

Fixed Twitter URL and selector in screenshot.js (and screenshot.coffee) sample

1 parent 33e0f6ce
......@@ -16,8 +16,8 @@ if not twitterAccount or not filename or not /\.(png|jpg|pdf)$/i.test filename
.echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>")
.exit(1)
casper.start "https://twitter.com/#!/#{twitterAccount}", ->
@waitForSelector ".tweet-row", (->
casper.start "https://twitter.com/#{twitterAccount}", ->
@waitForSelector ".stream-container", (->
@captureSelector filename, "html"
@echo "Saved screenshot of #{@getCurrentUrl()} to #{filename}"
), (->
......
......@@ -3,7 +3,7 @@
/**
* This script will capture a screenshot of a twitter account page
* Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>
* Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]>
*/
var casper = require("casper").create({
......@@ -18,13 +18,13 @@ var filename = casper.cli.get(1);
if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) {
casper
.echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>")
.echo("Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]>")
.exit(1)
;
}
casper.start("https://twitter.com/#!/" + twitterAccount, function() {
this.waitForSelector(".tweet-row", (function() {
casper.start("https://twitter.com/" + twitterAccount, function() {
this.waitForSelector(".stream-container", (function() {
this.captureSelector(filename, "html");
this.echo("Saved screenshot of " + (this.getCurrentUrl()) + " to " + filename);
}), (function() {
......