1

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?

1 Answer 1

2

Take a look at a headless browser, such as EnvJS.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.