I would like to use Readability's javascript to clean up news articles, then download the generated article. What this entails is being able to execute their js code:
window.baseUrl = 'https://www.readability.com';
window.readabilityToken = '';
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('charset','UTF-8');
s.setAttribute('src', baseUrl + '/bookmarklet/read.js');
document.documentElement.appendChild(s);
in an environment different from a traditional web browser. For example, this is possible to do by executing the above code on a site using Firebug; I would like to emulate that functionality through Java (without a browser). One of the problems I see here is the "window" object, which may not be present when accessing pages programmatically.
Any hints on whether this is possible and how to implement?