diff --git a/lib/index.js b/lib/index.js index cc076b4..a9ec4f8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -69,10 +69,16 @@ async function sanitizeDiscoverParams(params) { } async function getDiscoverOptions() { + if (cache.discoverOptions !== undefined) { + return cache.discoverOptions; + } const url = utils.getSiteUrl(); return fetch(url) .then( res => res.text() ) - .then( html => parser.parseDiscoverOptions(html) ); + .then( html => { + cache.discoverOptions = parser.parseDiscoverOptions(html); + return cache.discoverOptions; + }); } async function getImageFormat(idOrName) {