• This repository has been archived on 09/Mar/2021
  • Stars
    star
    461
  • Rank 95,028 (Top 2 %)
  • Language
    HTML
  • Created over 13 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Readability clone in Java

Future

Snacktory is no longer actively maintained by @karussell.

Crux is a fork under active development and is the recommended alternative.

  • Available under the same permissive Apache 2.0 License.
  • Adds several new features, such as Rich Text output (HTML), preserves links, extracts more metadata content, etc.
  • Optimized for Android. Decoupled from optional dependencies such as HttpUrlConnection, log4j, etc.
  • Actively developed by Chimbori, the developers of Hermit, a Lite Apps Browser for Android.
  • Already being used in multiple apps.
  • Crux has a different architecture from Snacktory: it is designed as a collection of several separate APIs instead of a single one. Clients can pick and choose which ones they wish to use.
  • As a result, Crux is not a drop-in replacement for Snacktory, but fairly easy to migrate to.

Snacktory

This is a small helper utility for people who 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, extract its text, keywords, its main picture and more.

The resulting quality is high, even paper.li uses the core of snacktory. Also have a look into this article, it describes a news aggregator service which uses snacktory. But jetslide is no longer online.

Snacktory borrows some ideas and a lot of test cases from goose and jreadability:

License

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

Features

  • article text detection
  • get top image url(s)
  • get top video url
  • extraction of description, keywords, ...
  • good detection for none-english sites (German, Japanese, ...), snacktory does not depend on the word count in its text detection to support CJK languages
  • good charset detection
  • possible to do URL resolving, but caching is still possible after resolving
  • skipping some known filetypes
  • no http GET required to run the core tests

TODOs

  • only top text supported at the moment

Usage

Include the repo at: https://github.com/karussell/mvnrepo

Then add the dependency

<dependency>
   <groupId>de.jetwick</groupId>
   <artifactId>snacktory</artifactId>
   <version>1.1</version>
   <!-- or if you prefer the latest build <version>1.2-SNAPSHOT</version> -->
</dependency>

If you need this for Android be sure you read this issue.

Or, if you prefer, you can use a build generated by jitpack.io.

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

More Repositories

1

elasticsearch-reindex

Simple re-indexing. To backup, apply index settings changes and more ElasticMagic
Java
228
star
2

jsii

[not maintained] Full Text Search Prototype in JavaScript
JavaScript
87
star
3

Jetwick

[not maintained] Custom Twitter Search via ElasticSearch&Wicket
Java
61
star
4

graphhopper-traffic-data-integration

[not maintained] Traffic data integration example for GraphHopper
JavaScript
44
star
5

ElasticSearchExample

[not maintained] Example using ElasticSearch and a UI
Java
28
star
6

elasticsearch-rollindex

ElasticSearch plugin for rolling indices.
Java
28
star
7

graphhopper-osm-id-mapping

Example how to map internal node or edge IDs to OSM IDs
Java
22
star
8

java-duke-blender

Java Duke files for Blender
17
star
9

fastutil

github clone
Java
10
star
10

optaplanner-graphhopper-example

Example on how to use Optaplanner in combination with GraphHopper
Java
8
star
11

lumeo

Implementing Tinkerpop Blueprints API via Lucene (not yet done - see blueprint api tests!)
Java
7
star
12

ElasticSearch4Android

ElasticSearch for Android - experiment to get it running ...
Java
4
star
13

goreplay-java-middleware

Sketch of a Java middleware for goreplay
Java
4
star
14

languator

language detection for local names like street and POI names
Java
4
star
15

EbbeFlut

A really nice board game implemented in a bad way a VERY long time ago
Java
3
star
16

geocoder

Geocoder
Java
3
star
17

mvnrepo

Micro Maven Repo
3
star
18

xvantage

case study for simple java <-> xml binding
Java
2
star
19

map-companies

Visual Overview Of Current Map Companies
2
star
20

plotter

Simple plotter - aka genvlin plotter
Java
2
star
21

TestTwitterAPI

testing result discrepancy search vs. streaming API
Java
2
star
22

twittertool

TwitterTool
Java
2
star
23

directions-api-python

Experiments with the GraphHopper Directions API and python
HTML
1
star
24

iot-test

Record sensor data from ESP32 and show via browser graph (plotly)
C++
1
star
25

igniteexample

Java
1
star
26

mapsforge

Mapsforge clone from Ludwig. See rescue branch.
Java
1
star
27

openlr

OpenLR (not official)
Java
1
star
28

graphhopper-native-image

Experiments with GraphHopper: GraalVM native image execution
Java
1
star