Skip to content

Commit

Permalink
Remove Dango API (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richienb committed Sep 5, 2021
1 parent 4273450 commit d98bb00
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
28 changes: 1 addition & 27 deletions index.js
@@ -1,18 +1,6 @@
'use strict';
const got = require('got');
const emojilib = require('emojilib');

const getGetdangoEmojis = async input => {
// Intentionally using `http` as the `https` endpoint has some stability problems.
const {results} = await got('http://emoji.getdango.com/api/emoji', {
searchParams: {
q: input
}
}).json();

return results.map(result => result.text);
};

// This value was picked experimentally.
// Substring search returns a lot of noise for shorter search words.
const MIN_WORD_LENGTH_FOR_SUBSTRING_SEARCH = 4;
Expand Down Expand Up @@ -45,18 +33,4 @@ const getEmojilibEmojis = input => {
return emoji;
};

module.exports = async input => {
const set = new Set();

for (const emoji of getEmojilibEmojis(input)) {
set.add(emoji);
}

try {
for (const emoji of await getGetdangoEmojis(input)) {
set.add(emoji);
}
} catch {}

return [...set];
};
module.exports = getEmojilibEmojis;
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -40,7 +40,6 @@
"clipboardy": "^2.2.0",
"conf": "^7.1.1",
"emojilib": "^2.4.0",
"got": "^11.5.2",
"import-jsx": "^4.0.0",
"ink": "^3.0.3",
"ink-text-input": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -4,7 +4,7 @@
<img src="screenshot.gif" width="660">

Uses the API from this great article on [Emoji & Deep Learning](https://getdango.com/emoji-and-deep-learning/) and a local emoji database.
Uses a local emoji database.

## Install

Expand Down

0 comments on commit d98bb00

Please sign in to comment.