<commit_before>// @flow
import chalk from 'chalk'
import fetch from 'node-fetch'
import ora from 'ora'

import cache from './emojisCache'

export const GITMOJIS_URL =
  'https://raw.githubusercontent.com/carloscuesta/gitmoji/master/src/data/gitmojis.json'

const getEmojis = (skipCache: boolean = false) => {
  if (cache.isAvailable() && !skipCache) return cache.getEmojis()

  const spinner = ora('Fetching the emoji list').start()

  return fetch(GITMOJIS_URL)
    .then((response) => response.json())
    .then((data) => {
      const emojis = data.gitmojis

      cache.createEmojis(emojis)
      spinner.succeed('Gitmojis fetched successfully')

      return emojis
    })
    .catch((error) => {
      spinner.fail(`Error: ${error}`)
    })
}

export default getEmojis<commit_msg>:sparkles: Use gitmoji API instead of raw.githubusercontent.com (#553)<commit_after>// @flow
import chalk from 'chalk'
import fetch from 'node-fetch'
import ora from 'ora'

import cache from './emojisCache'

export const GITMOJIS_URL = 'https://gitmoji.dev/api/gitmojis'

const getEmojis = (skipCache: boolean = false) => {
  if (cache.isAvailable() && !skipCache) return cache.getEmojis()

  const spinner = ora('Fetching the emoji list').start()

  return fetch(GITMOJIS_URL)
    .then((response) => response.json())
    .then((data) => {
      const emojis = data.gitmojis

      cache.createEmojis(emojis)
      spinner.succeed('Gitmojis fetched successfully')

      return emojis
    })
    .catch((error) => {
      spinner.fail(`Error: ${error}`)
    })
}

export default getEmojis
{'fraction_non_alphanumeric': 0.13904761904761906, 'fraction_numerical': 0.0019047619047619048, 'mean_word_length': 3.718562874251497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1321769', 'n_tokens_mistral': 564, 'n_tokens_neox': 555, 'n_words': 122}