Skip to content
/ forvo Public

Forvo’s API gives you access to 4 million audio pronunciations and translations in over 340 languages.

License

Notifications You must be signed in to change notification settings

mucsi96/forvo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forvo

Forvo’s API gives you access to 4 million audio pronunciations and translations in over 340 languages.

Getting started

First you need to have Forvo to be installed locally.

npm i --save forvo

Now you can get the best pronunciation for a word pronounced by native speaker. You need to have an API key for Forvo.

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
    const wordPronunciations = await forvo.standardPronunciation({ word: 'auf Wiederschauen', language: 'de' })
    // {
    //   items:[
    //     { id: 5943, word: 'auf_wiederschauen', original: 'auf Wiederschauen', pathmp3: 'https://apifree.forvo.com/audio/3h3h...
    //   ]
    // }
}

start().catch(err => console.log(err.stack));

API

Table of Contents

forvoApi

This function creates forvo api.

Parameters

  • options object Configuration object for forvo api
    • options.key string Your forvo api key

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });

Returns API Api

Api

This object represents a forvo Api.

Type: Object

Properties

  • wordPronunciations Api.wordPronunciations This function gets all the pronunciations from a word.
  • standardPronunciation Api.standardPronunciation This function gets the standard (top rated) pronunciation from a word.
  • languageList Api.languageList This function gets languages availables at Forvo.
  • popularLanguages Api.popularLanguages This function gets the most popular languages.
  • pronouncedWordsSearch Api.pronouncedWordsSearch This function gets words starting with a pattern alphabetically ordered with one or more pronunciations.
  • wordsSearch Api.wordsSearch This function gets words starting with a pattern alphabetically ordered.
  • popularPronouncedWords Api.popularPronouncedWords This function gets the most popular words with, at least, one pronunciation..

Api.wordPronunciations

This function gets all the pronunciations from a word.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.word string The word you want to get its pronunciations.
    • parameters.language string? To get only the pronunciations recorded in the given language.
    • parameters.country string? To get only the pronunciations recorded by users of this country. You should use the Alpha-3 code.
    • parameters.username string? Returns the pronunciation recorded by a specific user.
    • parameters.sex string? m (for male), f (for female)
    • parameters.rate number? To get only the pronunciations rated with at least the given value.
    • parameters.order string? date-desc (pronunciations order by pronounced time, from recent to older) date-asc (pronunciations order by pronounced time, older to recent) rate-desc (pronunciations order by rate, high rated first) rate-asc (pronunciations order by rate, low rated first)
    • parameters.limit number? Max. pronunciations returned.
    • parameters.groupInLanguages boolean? Group pronunciations in languages. Default value is false.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.wordPronunciations({ word: 'Apfel', language: 'de' })
  // {
  //   attributes: { total: 11 },
  //   items:[
  //     { id: 5943, word: 'apfel', original: 'Apfel', pathmp3: 'https://apifree.forvo.com/audio/3h3h...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> All the pronunciations from a word

Api.standardPronunciation

This function gets the standard (top rated) pronunciation from a word.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.word string The word you want to get its pronunciations.
    • parameters.language string? To get only the pronunciations recorded in the given language.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.standardPronunciation({ word: 'auf Wiederschauen', language: 'de' })
  // {
  //   items:[
  //     { id: 5943, word: 'auf_wiederschauen', original: 'auf Wiederschauen', pathmp3: 'https://apifree.forvo.com/audio/3h3h...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Standard (top rated) pronunciation from a word

Api.languageList

This function gets languages availables at Forvo.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.language string? Language code or "native" to get the language list with the names of the languages in their native languages. Default is English (en).
    • parameters.order string? Values: "name" or "code". Default is name.
    • parameters.minPronunciations number? Values: any integer number. To get only the languagues with, at least, the given number of pronunciations.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.languageList()
  // {
  //   attributes: { total: 349 },
  //   items:[
  //     { code: 'abq', en: 'Abaza' },
  //     { code: 'ab', en: 'Abkhazian' },
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Languages availables at Forvo.

Api.popularLanguages

This function gets the most popular languages.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.language string? Values: Language code or "native" to get the language list with the names of the languages in their native languages. Default is English (en).
    • parameters.order string? Values: "popular", "name" or "code". Default is "popular".
    • parameters.limit string? Values: any integer number. Max. languages returned. Default is 10.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.popularLanguages()
  // {
  //   attributes: { total: 10 },
  //   items:[
  //     { code: 'de', en: 'German' },
  //     { code: 'tt', en: 'Tatar' },
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> The most popular languages

Api.pronouncedWordsSearch

This function gets words starting with a pattern alphabetically ordered with one or more pronunciations.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.search string The pattern you want to search.
    • parameters.language string? To get only the pronunciations recorded in the given language.
    • parameters.pagesize number? Values: any integer number between 1-100. Set the page size in results. Default is 20.
    • parameters.page number? Values: any integer number. Set the page results you want to retrieve. Default is 1.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.pronouncedWordsSearch({ search: 'aus', language: 'de' })
  // {
  //   attributes: attributes: { page: 1, pagesize: 20, total_pages: 7, total: 121 },
  //   items:[
  //     { id: 20945, word: 'aus', original: 'aus', num_pronunciations: '4', standard_pronunciation: ... },
  //     { id: 20945, word: 'aus_dem_weg_gehen', original: 'aus dem Weg gehen', num_pronunciations ... }
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Words starting with a pattern alphabetically ordered with one or more pronunciations

Api.wordsSearch

This function gets words starting with a pattern alphabetically ordered.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.search string The pattern you want to search.
    • parameters.language string? To get only the pronunciations recorded in the given language.
    • parameters.pagesize number? Values: any integer number between 1-100. Set the page size in results. Default is 20.
    • parameters.page number? Values: any integer number. Set the page results you want to retrieve. Default is 1.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.wordsSearch({ search: 'aus', language: 'de' })
  // {
  //   attributes: attributes: { page: 1, pagesize: 20, total_pages: 7, total: 121 },
  //   items:[
  //     { id: 20945, word: 'aus', original: 'aus', num_pronunciations: '4', standard_pronunciation: ... },
  //     { id: 20945, word: 'aus_dem_weg_gehen', original: 'aus dem Weg gehen', num_pronunciations ... }
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Words starting with a pattern alphabetically ordered

Api.popularPronouncedWords

This function gets the most popular words with, at least, one pronunciation.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.language string? To get only the words in the given language.
    • parameters.limit number? Values: any integer number. Max. word returned. Default is 1000.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.popularPronouncedWords({ language: 'de' })
  // {
  //   attributes: { total: 993 },
  //   items:[
  //     { id: 5619, word: 'adidas', original: 'Adidas', num_pronunciations: '4' },
  //     { id: 3697234, word: 'airbagbereich', original: 'Airbagbereich', num_pronunciations: '3' }
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> The most popular words with, at least, one pronunciation.

About

Forvo’s API gives you access to 4 million audio pronunciations and translations in over 340 languages.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published