Created
February 19, 2021 12:06
-
-
Save y-young/ba1ee05a67eb9276294ef8b87d4b0499 to your computer and use it in GitHub Desktop.
Twitter Followings JSON to YAML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Twitter Followings JSON to YAML | |
Usage: | |
1. Use https://gist.github.com/y-young/031291b39e425472a26d973bd9aa52ee to get `users.json` | |
2. Install 'js-yaml': 'npm i js-yaml` or `yarn add js-yaml` | |
3. Run the script: `node twitter-followings-json2yaml.js` | |
4. Output is in `twitter_data.yaml`, paste it into gist | |
*/ | |
const fs = require("fs/promises"); | |
const yaml = require("js-yaml"); | |
(async () => { | |
const entries = JSON.parse(await fs.readFile("users.json")); | |
const users = {}; | |
for (const entry of entries) { | |
users[entry] = {}; | |
} | |
await fs.writeFile("twitter_data.yaml", yaml.dump(users)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment