diff --git a/ChangeLog b/ChangeLog index 6ae34490..8efe3b9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,7 @@ Please see also http://code.google.com/p/phantomjs/wiki/ReleaseNotes. * Fixed example scripts to exit with the right exit code (issue 544) * Fixed build failure with glib 2.31.0+ (issue 559) * Fixed error handler failures in some cases (issue 589) + * Fixed Twitter-related examples to work with the new site (issue 609) 2012-03-20: Version 1.5.0 "Ghost Flower" diff --git a/examples/follow.coffee b/examples/follow.coffee index ed479f1e..1735dd37 100644 --- a/examples/follow.coffee +++ b/examples/follow.coffee @@ -14,7 +14,7 @@ follow = (user, callback) -> if status is 'fail' console.log user + ': ?' else - data = page.evaluate -> document.querySelector('div.timeline-following').innerText + data = page.evaluate -> document.querySelector('div.profile td.stat.stat-last div.statnum').innerText; console.log user + ': ' + data callback.apply() diff --git a/examples/follow.js b/examples/follow.js index ad0dbc64..4687f290 100644 --- a/examples/follow.js +++ b/examples/follow.js @@ -13,7 +13,7 @@ function follow(user, callback) { console.log(user + ': ?'); } else { var data = page.evaluate(function () { - return document.querySelector('div.timeline-following').innerText; + return document.querySelector('div.profile td.stat.stat-last div.statnum').innerText; }); console.log(user + ': ' + data); } diff --git a/examples/tweets.coffee b/examples/tweets.coffee index ed1197be..ca96357d 100644 --- a/examples/tweets.coffee +++ b/examples/tweets.coffee @@ -25,7 +25,7 @@ page.open encodeURI("http://mobile.twitter.com/#{twitterId}"), (status) -> else # Execute some DOM inspection within the page context page.evaluate -> - list = document.querySelectorAll 'span.status' + list = document.querySelectorAll 'div.tweet-text' for i, j in list - console.log "#{j + 1}: #{i.innerHTML.replace /<.*?>/g, ''}" + console.log "#{j + 1}: #{i.innerText}" phantom.exit() diff --git a/examples/tweets.js b/examples/tweets.js index 5dbda760..c8f20964 100644 --- a/examples/tweets.js +++ b/examples/tweets.js @@ -27,9 +27,9 @@ page.open(encodeURI("http://mobile.twitter.com/" + twitterId), function (status) } else { // Execute some DOM inspection within the page context page.evaluate(function() { - var list = document.querySelectorAll('span.status'); + var list = document.querySelectorAll('div.tweet-text'); for (var i = 0; i < list.length; ++i) { - console.log((i + 1) + ": " + list[i].innerHTML.replace(/<.*?>/g, '')); + console.log((i + 1) + ": " + list[i].innerText); } }); }