Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Readability clone in Java for Jetslide
Branch: master
Pull request Compare This branch is 92 commits behind karussell:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
test_data
.gitignore
README
TODO.txt
pom.xml

README

= Snacktory

This is a small helper utility for pepole don't want to write yet another java clone of Readability.

In most cases, this is applied to articles, although it should work for any website to find its 
major area and extract its text and its important picture.

Have a look into http://jetsli.de where Snacktory is used. Jetslide is a new way to consume news,
it does not only display the Websites' title but it displays a small preview of the site ('a snack') 
and the important image if available.

= License 

The software stands under Apache 2 License and comes with NO WARRANTY

= Features

Snacktory borrows some ideas from jReadability 

https://github.com/ifesdjeen/jReadability

and goose (ideas + a lot test cases):

https://github.com/jiminoc/goose

The advantages over jReadability are
    * better article text detection than jReadability 
    * only Java deps
    * more tests

The advantages over Goose are
    * similar article text detection although better detection for none-english sites (German, Japanese, ...)
    * snacktory does not depend on the word count in its text detection to support CJK languages
    * no external Services required to run the core tests => faster tests
    * better charset detection
    * with url resolving, but caching is still possible after resolving
    * skipping some known filetypes

The disadvantages to Goose are
    * only top image and top text supported at the moment
    * some articles which passed do not pass. 
      But added a bunch of other useful sites (stackoverflow, facebook, other languages ...)


= Usage
 Include the repo at see README: https://github.com/karussell/mvnrepo
 Then add the dependency
 <dependency>
    <groupId>de.jetwick</groupId>
    <artifactId>snacktory</artifactId>
    <version>1.0-SNAPSHOT</version>
 </dependency>
 
 Now you can use it as follows:
 
 HtmlFetcher fetcher = new HtmlFetcher();
 // set cache. e.g. take the map implementation from google collections:
 // fetcher.setCache(new MapMaker().concurrencyLevel(20).maximumSize(count).expireAfterWrite(minutes, TimeUnit.MINUTES).makeMap();

 JResult res = fetcher.fetchAndExtract(articleUrl, resolveTimeout, true);
 String text = res.getText(); 
 String title = res.getTitle(); 
 String imageUrl = res.getImageUrl();

= Build

via Maven. Maven will automatically resolve dependencies to jsoup, log4j and slf4j-api
Something went wrong with that request. Please try again.