mirror of https://github.com/vitalif/phantomjs
Fix Twitter-related examples to work with the new site.
http://code.google.com/p/phantomjs/issues/detail?id=6091.6
parent
78b1e271d6
commit
ffc594e264
|
@ -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 example scripts to exit with the right exit code (issue 544)
|
||||||
* Fixed build failure with glib 2.31.0+ (issue 559)
|
* Fixed build failure with glib 2.31.0+ (issue 559)
|
||||||
* Fixed error handler failures in some cases (issue 589)
|
* 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"
|
2012-03-20: Version 1.5.0 "Ghost Flower"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ follow = (user, callback) ->
|
||||||
if status is 'fail'
|
if status is 'fail'
|
||||||
console.log user + ': ?'
|
console.log user + ': ?'
|
||||||
else
|
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
|
console.log user + ': ' + data
|
||||||
callback.apply()
|
callback.apply()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ function follow(user, callback) {
|
||||||
console.log(user + ': ?');
|
console.log(user + ': ?');
|
||||||
} else {
|
} else {
|
||||||
var data = page.evaluate(function () {
|
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);
|
console.log(user + ': ' + data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ page.open encodeURI("http://mobile.twitter.com/#{twitterId}"), (status) ->
|
||||||
else
|
else
|
||||||
# Execute some DOM inspection within the page context
|
# Execute some DOM inspection within the page context
|
||||||
page.evaluate ->
|
page.evaluate ->
|
||||||
list = document.querySelectorAll 'span.status'
|
list = document.querySelectorAll 'div.tweet-text'
|
||||||
for i, j in list
|
for i, j in list
|
||||||
console.log "#{j + 1}: #{i.innerHTML.replace /<.*?>/g, ''}"
|
console.log "#{j + 1}: #{i.innerText}"
|
||||||
phantom.exit()
|
phantom.exit()
|
||||||
|
|
|
@ -27,9 +27,9 @@ page.open(encodeURI("http://mobile.twitter.com/" + twitterId), function (status)
|
||||||
} else {
|
} else {
|
||||||
// Execute some DOM inspection within the page context
|
// Execute some DOM inspection within the page context
|
||||||
page.evaluate(function() {
|
page.evaluate(function() {
|
||||||
var list = document.querySelectorAll('span.status');
|
var list = document.querySelectorAll('div.tweet-text');
|
||||||
for (var i = 0; i < list.length; ++i) {
|
for (var i = 0; i < list.length; ++i) {
|
||||||
console.log((i + 1) + ": " + list[i].innerHTML.replace(/<.*?>/g, ''));
|
console.log((i + 1) + ": " + list[i].innerText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue