diff --git a/cli.js b/cli.js index bc68022..4f8ab25 100755 --- a/cli.js +++ b/cli.js @@ -159,7 +159,11 @@ program.command('create-user ') console.log(`Error: ${err.error}`) return }) - console.log(await jsonOut); + + const userSlug = JSON.parse(jsonOut).data.users[0].slug + const outFile = `user-${userSlug}.json` + await fs.promises.writeFile(outFile, jsonOut, 'utf-8') + console.log(`Saved to ${outFile}`); }); program.command('webdav-test ') diff --git a/seance.js b/seance.js index 93873ff..636265d 100644 --- a/seance.js +++ b/seance.js @@ -417,7 +417,7 @@ class Seance { const mediumUrl = `https://medium.com/@${mediumUsername}/?format=json`; - const json = await fetchMediumJSON(mediumUrl); + const json = await this.fetchMediumJSON(mediumUrl); if (!json.success) { this.emit('error', { @@ -447,7 +447,7 @@ class Seance { loglevel: 'debug' }) - let imagePath = MEDIUM_IMG_CDN + '256/256/' + imageId + let imagePath = this.MEDIUM_IMG_CDN + '256/256/' + imageId let filetype = imageId.split('.')[imageId.split('.').length - 1] let fileName = `${mediumUsername}.${filetype}` let filePath = path.join(process.env.PWD, fileName)