diff --git a/seance.js b/seance.js index 636265d..61a40c7 100644 --- a/seance.js +++ b/seance.js @@ -336,9 +336,19 @@ class Seance { var text if (mediumUrl.match(/^http/i)) { - // add ?json attribute + // remove the anchors at the end mediumUrl = mediumUrl.replace(/#.*$/, '') - mediumUrl= `${mediumUrl}?format=json` + + // intelligently add ?json attribute + if (mediumUrl.indexOf('format=json') == -1) { + if (mediumUrl.indexOf('?') == 0) { + mediumUrl = `${mediumUrl}?format=json` + } else { + mediumUrl = `${mediumUrl}&format=json` + } + } + + // let's get it! const response = await fetch(mediumUrl) text = await response.text() } else if (fs.existsSync(mediumUrl)) {