Fix Twitter-related examples to work with the new site.

http://code.google.com/p/phantomjs/issues/detail?id=609
1.6
Ariya Hidayat 2012-06-20 22:53:14 -07:00
parent 78b1e271d6
commit ffc594e264
5 changed files with 7 additions and 6 deletions

View File

@ -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"

View File

@ -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()

View File

@ -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);
}

View File

@ -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()

View File

@ -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);
}
});
}