Skip to content

jloomis/snacktory

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= 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

About

Readability clone in Java for Jetslide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.8%
  • Shell 0.2%