Forgot to save. Duh.
This commit is contained in:
parent
46d20c2652
commit
cc58d82c4e
1 changed files with 34 additions and 33 deletions
67
README.md
67
README.md
|
@ -1,55 +1,64 @@
|
||||||
[](http://opensource.org/licenses/BSD-3-Clause) [](https://github.com/ethauvin/isgd-shorten/releases/latest) [](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/isgd-shorten) [](https://bintray.com/ethauvin/maven/isgd-shorten/_latestVersion)
|
[](http://opensource.org/licenses/BSD-3-Clause) [](https://github.com/ethauvin/readingtime/releases/latest) [](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/readingtime) [](https://bintray.com/ethauvin/maven/readingtime/_latestVersion)
|
||||||
|
|
||||||
[](https://snyk.io/test/github/ethauvin/isgd-shorten?targetFile=pom.xml) [](https://sonarcloud.io/dashboard?id=ethauvin_isgd-shorten) [](https://travis-ci.com/ethauvin/isgd-shorten) [](https://circleci.com/gh/ethauvin/isgd-shorten/tree/master)
|
[](https://snyk.io/test/github/ethauvin/readingtime?targetFile=pom.xml) [](https://sonarcloud.io/dashboard?id=ethauvin_readingtime) [](https://travis-ci.com/ethauvin/readingtime) [](https://circleci.com/gh/ethauvin/readingtime/tree/master)
|
||||||
|
|
||||||
# [is.gd](https://is.gd/developers.php) Shortener for Kotlin/Java
|
# Estimated Reading Time for Blog Posts, Articles, etc.
|
||||||
|
|
||||||
A simple implementation of the [is.gd API](https://is.gd/developers.php).
|
A simple Kotlin/Java implementation of [Medium's Read Time calculation](https://blog.medium.com/read-time-and-you-bc2048ab620c).
|
||||||
|
|
||||||
## Examples (TL;DR)
|
## Examples (TL;DR)
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
import net.thauvin.erik.isgd.Isgd
|
import net.thauvin.erik.readingtime.ReadingTime
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
Isgd.shorten("https://www.example.com/") // returns https://is.gd/Pt2sET
|
val rt = ReadingTime(htmlText);
|
||||||
Isgd.lookup("https://is.gd/Pt2sET") // returns https://www.example.com
|
println(rt.calcEstimatedReadTime()) // Outputs: X min read
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- View [Kotlin](https://github.com/ethauvin/isgd-shorten/blob/master/examples/src/main/kotlin/com/example/IsgdExample.kt) or [Java](https://github.com/ethauvin/isgd-shorten/blob/master/examples/src/main/java/com/example/IsgdSample.java) Examples.
|
where X is the estimated reading time for the given text.
|
||||||
|
|
||||||
|
- View [Kotlin](https://github.com/ethauvin/readingtime/blob/master/examples/src/main/kotlin/com/example/ReadingTimeExample.kt) or [Java](https://github.com/ethauvin/readingtime/blob/master/examples/src/main/java/com/example/ReadingTimeSample.java) Examples.
|
||||||
|
|
||||||
|
|
||||||
### JSON or XML
|
|
||||||
|
|
||||||
The [is.gd API](https://is.gd/developers.php) can return data in plain text (default), JSON or XML.
|
### Properties
|
||||||
|
|
||||||
|
The following properties are available:
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
Isgd.shorten("https://www.example.com/", format = Format.JSON)
|
ReadingTime(
|
||||||
|
text = "sometext",
|
||||||
|
wpm = 275,
|
||||||
|
postfix = "min read",
|
||||||
|
plural = "min read",
|
||||||
|
excludeImages = false
|
||||||
|
)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
returns:
|
Property | Description
|
||||||
|
:-------------------------- |:-------------------------------------------------------------------
|
||||||
|
`text` | The text to be evaluated.
|
||||||
|
`wpm` | The words per minute reading average.
|
||||||
|
`postfix` | The value to be appended to the reading time.
|
||||||
|
`plural` | The value to be appended if the reading time is more than 1 minute.
|
||||||
|
`excludeImages` | Images are excluded from the reading time when set.
|
||||||
|
|
||||||
```json
|
### Functions
|
||||||
{ "shorturl": "https://is.gd/Pt2sET" }
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
A couple of useful functions are also available:
|
||||||
|
|
||||||
All of the [is.gd API](https://is.gd/developers.php) parameters are supported:
|
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
Isgd.shorten(url = url, shorturl="foobar", callback = "test", logstats = true, format = Format.JSON)
|
ReadingTime.wordCount(htmlText) // Returns the count of words. (HTML stripped)
|
||||||
|
ReadingTime.imgCount(htmlText) // Returns the count of images. (img HTML tags)
|
||||||
```
|
```
|
||||||
returns:
|
|
||||||
|
|
||||||
```json
|
|
||||||
test({ "shorturl": "https://is.gd/foobar" });
|
|
||||||
```
|
|
||||||
### Gradle
|
### Gradle
|
||||||
|
|
||||||
To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/isgd-shorten/blob/master/examples/build.gradle.kts) file:
|
To use with [Gradle](https://gradle.org/), include the following dependency in your [build](https://github.com/ethauvin/readingtime/blob/master/examples/build.gradle.kts) file:
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -57,14 +66,6 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("net.thauvin.erik:isgd-shorten:0.9.1")
|
implementation("net.thauvin.erik:readingtime:0.9.0")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### v.gd
|
|
||||||
|
|
||||||
Additionally, link can be shortened using [v.gd](https://v.gd/) by setting the `isVgd` flag:
|
|
||||||
|
|
||||||
```kotlin
|
|
||||||
Isgd.shorten("https://www.example.com/", isVgd = true) // returns https://v.gd/2z2ncj
|
|
||||||
```
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue