image-resolver

A Java 8 library to extract main image from a URL or HTML

Лицензия

Лицензия

Apache
Группа

Группа

com.shekhargulati
Идентификатор

Идентификатор

image-resolver
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

image-resolver
A Java 8 library to extract main image from a URL or HTML
Ссылка на сайт

Ссылка на сайт

https://github.com/shekhargulati/image-resolver
Система контроля версий

Система контроля версий

https://github.com/shekhargulati/image-resolver.git

Скачать image-resolver

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.shekhargulati/image-resolver/ -->
<dependency>
    <groupId>com.shekhargulati</groupId>
    <artifactId>image-resolver</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.shekhargulati/image-resolver/
implementation 'com.shekhargulati:image-resolver:0.1.0'
// https://jarcasting.com/artifacts/com.shekhargulati/image-resolver/
implementation ("com.shekhargulati:image-resolver:0.1.0")
'com.shekhargulati:image-resolver:jar:0.1.0'
<dependency org="com.shekhargulati" name="image-resolver" rev="0.1.0">
  <artifact name="image-resolver" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.shekhargulati', module='image-resolver', version='0.1.0')
)
libraryDependencies += "com.shekhargulati" % "image-resolver" % "0.1.0"
[com.shekhargulati/image-resolver "0.1.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.squareup.okhttp3 : okhttp jar 3.5.0
org.jsoup : jsoup jar 1.10.2
org.slf4j : slf4j-api jar 1.7.22

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.assertj : assertj-core jar 3.6.2
org.slf4j : slf4j-simple jar 1.7.22

Модули Проекта

Данный проект не имеет модулей.

image-resolver Build Status codecov.io License

A Java 8 library to extract main image from a URL. Getting Started

To use image-resolver in your application, you have to add image-resolver in your classpath. image-resolver is available on Maven Central so you just need to add dependency to your favorite build tool as show below.

For Apache Maven users, please add following to your pom.xml.

<dependencies>
    <dependency>
        <groupId>com.shekhargulati</groupId>
        <artifactId>image-resolver</artifactId>
        <version>0.1.0</version>
    </dependency>
</dependencies>

Gradle users can add following to their build.gradle file.

compile(group: 'com.shekhargulati', name: 'image-resolver', version: '0.1.0')

Using the API

It is very easy to use the API.

Extracting image from URL.

String url = "https://medium.com/the-mission/how-to-get-people-to-like-you-in-5-seconds-or-less-67e64cb91155#.tp52bdm6m";
Optional<String> mainImage = MainImageResolver.resolveMainImage(url);
// Return  Optional("https://cdn-images-1.medium.com/max/1200/1*-yql2CobEo8rGLCZv2gOyw.jpeg")

Extracting image from HTML

Optional<String> mainImage = MainImageResolver.resolveMainImageFromHtml(html)

Extracting image using your HTML fetcher

If you want to use your own way to fetch HTML then you can use.

Optional<String> mainImage = MainImageResolver.resolveMainImage(url, url -> fetchHtml(), ImageResolvers.webpageResolvers);

Inspiration

This library is inspired by Maurice Svay ImageResolver JavaScript library.

Версии библиотеки

Версия
0.1.0