1.0.1 • Published 4 years ago

@eibens/emoji-list v1.0.1

Weekly downloads
2
License
-
Repository
-
Last release
4 years ago

emoji list

This repository contains a list of all emoji metadata scraped from this website (WARNING: downloads 27 MB). I made this because I could not find any readily available list with both names AND unicode codepoints. You can use this list together with your favorite emoji set:

The list is a JSON array of objects, each with a category, subcategory, name, and array of codes. Here are the first two emojis from emoji.json as an example:

[
  {
    "category": "Smileys & Emotion",
    "subcategory": "face-smiling",
    "name": "grinning face",
    "codes": [
      "1F600"
    ]
  },
  {
    "category": "Smileys & Emotion",
    "subcategory": "face-smiling",
    "name": "grinning face with big eyes",
    "codes": [
      "1F603"
    ]
  }
]

npm

You can get the list from npm:

npm install @eibens/emoji-list

The emoji list object is the default export of the package:

import emojiList from '@eibens/emoji-list'

emojiList.forEach(emoji => console.log(emoji.name))

Do it yourself

You can export the list yourself, if you wish. The steps were tested and work in newest Firefox and Google Chrome:

  1. Copy the source code below.
  2. Go to this website (WARNING: downloads 27 MB)
  3. Open the browser console (F12 or right click and Inspect Element).
  4. Paste the source code into the console and press Enter.
  5. Wait a few seconds until the console outputs emojis gathered!.
  6. The emoji list is now in your clipboard and you can paste it anywhere.
format = false // change to `true` if you want formatted output
copy((format => {
  function Xs (node, path) {
    const result = node.ownerDocument
      .evaluate(path, node, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null)
    const nodes = []
    let n
    while (n = result.iterateNext()) nodes.push(n)
    return nodes
  }
  function XText (node, path) {
    return Xs(node, path)[0].textContent
  }
  const list = Xs(document.body, '//tr[td]').map(tr => ({ 
    category: XText(tr, '(preceding::tr/th[@class="bighead"])[last()]'),
    subcategory: XText(tr, '(preceding::tr/th[@class="mediumhead"])[last()]'),
    // must replace '⊛' in name of recently added emojis 
    name: XText(tr, 'td[last()]').replace(/⊛/, '').trim(),
    // multiple codes in single anchor tag
    codes: XText(tr, 'td[2]/a').split(' ').map(code => code.substr(2))
  }))
  return JSON.stringify(list, null, format ? 2 : null)
})(format))
console.log('emojis gathered!')

Contact

:pencil: Lukas Eibensteiner :e-mail: l.eibensteiner@gmail.com :package: eibens/emoji-list