Skip to content

Instantly share code, notes, and snippets.

@danott
Last active June 3, 2024 20:14
Show Gist options
  • Save danott/615135 to your computer and use it in GitHub Desktop.
Save danott/615135 to your computer and use it in GitHub Desktop.
YouVersion.com URL Abbreviations
/*!
* youversion_abbreviations.js
* JSON of YouVersion.com Bible Book URL Abbreviations.
*/
var books = {
'gen': 'Genesis',
'exo': 'Exodus',
'lev': 'Leviticus',
'num': 'Numbers',
'deu': 'Deuteronomy',
'jos': 'Joshua',
'jdg': 'Judges',
'rut': 'Ruth',
'1sa': '1 Samuel',
'2sa': '2 Samuel',
'1ki': '1 Kings',
'2ki': '2 Kings',
'1ch': '1 Chronicles',
'2ch': '2 Chronicles',
'ezr': 'Ezra',
'neh': 'Nehemiah',
'est': 'Esther',
'job': 'Job',
'psa': 'Psalm',
'pro': 'Proverbs',
'ecc': 'Ecclesiastes',
'sng': 'Song of Solomon',
'isa': 'Isaiah',
'jer': 'Jeremiah',
'lam': 'Lamentations',
'ezk': 'Ezekiel',
'dan': 'Daniel',
'hos': 'Hosea',
'jol': 'Joel',
'amo': 'Amos',
'oba': 'Obadiah',
'jon': 'Jonah',
'mic': 'Micah',
'nam': 'Nahum',
'hab': 'Habakkuk',
'zep': 'Zephaniah',
'hag': 'Haggai',
'zec': 'Zechariah',
'mal': 'Malachi',
'mat': 'Matthew',
'mrk': 'Mark',
'lke': 'Luke',
'jhn': 'John',
'act': 'Acts',
'rom': 'Romans',
'1co': '1 Corinthians',
'2co': '2 Corinthians',
'gal': 'Galatians',
'eph': 'Ephesians',
'php': 'Philippians',
'col': 'Colossians',
'1th': '1 Thessalonians',
'2th': '2 Thessalonians',
'1ti': '1 Timothy',
'2ti': '2 Timothy',
'tit': 'Titus',
'phm': 'Philemon',
'heb': 'Hebrews',
'jas': 'James',
'1pe': '1 Peter',
'2pe': '2 Peter',
'1jn': '1 John',
'2jn': '2 John',
'3jn': '3 John',
'jud': 'Jude',
'rev': 'Revelation'
}
@imjosh
Copy link

imjosh commented Jun 3, 2024

I wrote script to fetch the abbreviations from Bible.com in case they've changed again. This needs to be run from a browser developer console with a bible.com page loaded. You have to specify the Bible version. I doubt the abbreviations are different per version but they could be in theory.

There is an official api available as well: https://scripture.api.bible/

async function fetchAbbreviations(versionCode) {
  try {
    const response = await fetch(`https://www.bible.com/api/bible/version/${versionCode}`);
    if (!response.ok) {
      throw new Error('Network response was not ok');
    }
    const data = await response.json();
    const abbreviations = {};
    data.books.forEach(b => {
      abbreviations[b.usfm] = b.human;
    })
    console.log(JSON.stringify(abbreviations, null, 4));
  } catch (error) {
    console.error(error);
  }
}

let versionCodes = {
  LSB: 3345,
  ESV: 59,
  KJV: 547,
};

fetchAbbreviations(versionCodes.LSB);

var books =
{
    "GEN": "Genesis",
    "EXO": "Exodus",
    "LEV": "Leviticus",
    "NUM": "Numbers",
    "DEU": "Deuteronomy",
    "JOS": "Joshua",
    "JDG": "Judges",
    "RUT": "Ruth",
    "1SA": "1 Samuel",
    "2SA": "2 Samuel",
    "1KI": "1 Kings",
    "2KI": "2 Kings",
    "1CH": "1 Chronicles",
    "2CH": "2 Chronicles",
    "EZR": "Ezra",
    "NEH": "Nehemiah",
    "EST": "Esther",
    "JOB": "Job",
    "PSA": "Psalm",
    "PRO": "Proverbs",
    "ECC": "Ecclesiastes",
    "SNG": "Song of Songs",
    "ISA": "Isaiah",
    "JER": "Jeremiah",
    "LAM": "Lamentations",
    "EZK": "Ezekiel",
    "DAN": "Daniel",
    "HOS": "Hosea",
    "JOL": "Joel",
    "AMO": "Amos",
    "OBA": "Obadiah",
    "JON": "Jonah",
    "MIC": "Micah",
    "NAM": "Nahum",
    "HAB": "Habakkuk",
    "ZEP": "Zephaniah",
    "HAG": "Haggai",
    "ZEC": "Zechariah",
    "MAL": "Malachi",
    "MAT": "Matthew",
    "MRK": "Mark",
    "LUK": "Luke",
    "JHN": "John",
    "ACT": "Acts",
    "ROM": "Romans",
    "1CO": "1 Corinthians",
    "2CO": "2 Corinthians",
    "GAL": "Galatians",
    "EPH": "Ephesians",
    "PHP": "Philippians",
    "COL": "Colossians",
    "1TH": "1 Thessalonians",
    "2TH": "2 Thessalonians",
    "1TI": "1 Timothy",
    "2TI": "2 Timothy",
    "TIT": "Titus",
    "PHM": "Philemon",
    "HEB": "Hebrews",
    "JAS": "James",
    "1PE": "1 Peter",
    "2PE": "2 Peter",
    "1JN": "1 John",
    "2JN": "2 John",
    "3JN": "3 John",
    "JUD": "Jude",
    "REV": "Revelation"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment