forked from GravityLabs/goose
-
Notifications
You must be signed in to change notification settings - Fork 59
Configuration
jiminoc edited this page Aug 21, 2011
·
4 revisions
There will be times you need to configure different locations for defaults. Goose provides a configuration object that can be passed into the extractor so you can set items that make sense to your environment.
See example below:
public class GooseTest {
@Test
public void gooseFromJavaTest() {
// set my configuration options for goose
Configuration configuration = new Configuration();
configuration.setMinBytesForImages(4500);
configuration.setLocalStoragePath("/tmp/goose");
configuration.setEnableImageFetching(false); // i don't care about the image, just want text, this is much faster!
configuration.setImagemagickConvertPath("/opt/local/bin/convert");
String url = "http://www.cnn.com/2010/POLITICS/08/13/democrats.social.security/index.html";
Goose goose = new Goose(configuration);
Article article = goose.extractContent(url);
System.out.println(article.cleanedArticleText());
}
}