From d24980e1e638d9f5ff3745d522d6e263b7094d29 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Sat, 31 Aug 2024 19:29:32 +0200 Subject: [PATCH] Load Instagram backup post list --- README.md | 10 ++++++++-- main.ts | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7cb9fcf..37b521b 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,16 @@ git clone https://git.sprovoost.nl/instablossom.git cd instablossom ``` +Download your Instagram archive and unzip it. + Run the script: ```sh -deno run --allow-net main.ts +deno run --allow-read --allow-net main.ts ``` -It will prompt for your nsec and a relay. +First it will prompt for the path of your archive. + +E.g. `/Users/you/Downloads/instagram-you-2024-01-01-abcdef` + +Next it will prompt for your nsec and a relay. diff --git a/main.ts b/main.ts index 3aa5929..6718c63 100644 --- a/main.ts +++ b/main.ts @@ -12,7 +12,21 @@ console.log("\nUse at your own risk!\n"); console.log("Considering trying it out with a throwaway nsec."); console.log("All data will be public. Anything you upload is hard to delete.\n"); -const nsec_str = prompt("Please enter your nsec:"); +const path = prompt("Enter Instagram backup (absolute) path (unzip first): "); +const posts = JSON.parse(await Deno.readTextFile(path + "/content/posts_1.json")); + +console.log("Number of posts:", posts.length); + +console.log("You can try one picture at a time, duplicates are skipped the next run."); + +const n = Number(prompt("How many do you want to upload?", posts.length)); + +if (n == 0) { Deno.exit(0); } + +assert(n > 0); +assert(n <= posts.length); + +const nsec_str = prompt("\nPlease enter your nsec:"); // Sanity check format NSchema.bech32('nsec').parse(nsec_str);