Fixed Twitter URL and selector in screenshot.js (and screenshot.coffee) sample
Showing
2 changed files
with
6 additions
and
6 deletions
... | @@ -16,8 +16,8 @@ if not twitterAccount or not filename or not /\.(png|jpg|pdf)$/i.test filename | ... | @@ -16,8 +16,8 @@ if not twitterAccount or not filename or not /\.(png|jpg|pdf)$/i.test filename |
16 | .echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>") | 16 | .echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>") |
17 | .exit(1) | 17 | .exit(1) |
18 | 18 | ||
19 | casper.start "https://twitter.com/#!/#{twitterAccount}", -> | 19 | casper.start "https://twitter.com/#{twitterAccount}", -> |
20 | @waitForSelector ".tweet-row", (-> | 20 | @waitForSelector ".stream-container", (-> |
21 | @captureSelector filename, "html" | 21 | @captureSelector filename, "html" |
22 | @echo "Saved screenshot of #{@getCurrentUrl()} to #{filename}" | 22 | @echo "Saved screenshot of #{@getCurrentUrl()} to #{filename}" |
23 | ), (-> | 23 | ), (-> | ... | ... |
... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * This script will capture a screenshot of a twitter account page | 5 | * This script will capture a screenshot of a twitter account page |
6 | * Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]> | 6 | * Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]> |
7 | */ | 7 | */ |
8 | 8 | ||
9 | var casper = require("casper").create({ | 9 | var casper = require("casper").create({ |
... | @@ -18,13 +18,13 @@ var filename = casper.cli.get(1); | ... | @@ -18,13 +18,13 @@ var filename = casper.cli.get(1); |
18 | 18 | ||
19 | if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) { | 19 | if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) { |
20 | casper | 20 | casper |
21 | .echo("Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>") | 21 | .echo("Usage: $ casperjs screenshot.js <twitter-account> <filename.[jpg|png|pdf]>") |
22 | .exit(1) | 22 | .exit(1) |
23 | ; | 23 | ; |
24 | } | 24 | } |
25 | 25 | ||
26 | casper.start("https://twitter.com/#!/" + twitterAccount, function() { | 26 | casper.start("https://twitter.com/" + twitterAccount, function() { |
27 | this.waitForSelector(".tweet-row", (function() { | 27 | this.waitForSelector(".stream-container", (function() { |
28 | this.captureSelector(filename, "html"); | 28 | this.captureSelector(filename, "html"); |
29 | this.echo("Saved screenshot of " + (this.getCurrentUrl()) + " to " + filename); | 29 | this.echo("Saved screenshot of " + (this.getCurrentUrl()) + " to " + filename); |
30 | }), (function() { | 30 | }), (function() { | ... | ... |
-
Please register or sign in to post a comment