GithubHelp home page GithubHelp logo

snacktory's Introduction

Snacktory

This is a small helper utility for pepole 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>

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

snacktory's People

Contributors

dajac avatar bejean avatar ifesdjeen avatar jloomis avatar soebbing avatar tjerkw avatar kireet avatar pyr avatar

Watchers

Maxim Filippovich avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.