Download Your Instagram Data from the Account Deletion Interface
💡 You will not be deleting your account, you will only proceed to the download my data section
Converting saved_collections.json
file to csv
const { readFileSync, writeFileSync } = require("fs")
function jsonToCSV(json) {
const csvRows = []
csvRows.push("Name,Time,URL,Channel,Tags")
for (const [key, value] of Object.entries(json)) {
const tags = value.tags.join(",")
const utcTime = value.time.toISOString()
csvRows.push(`${value.name},${utcTime},${key},${value.channel},"${tags}"`)
}
return csvRows.join("\\n")
}
function instagramCollectionToCSV(inputPath) {
const content = JSON.parse(readFileSync(inputPath))
const data = {}
let tag = undefined
content.saved_saved_collections.forEach(collection => {
const url = collection.string_map_data.Name.href
if (url === undefined) {
const rawTag = collection.string_map_data.Name.value
tag = Buffer.from(rawTag, "binary").toString("utf8")
return
}
const name = url.split("/").slice(-2)[0]
const time = new Date(collection.string_map_data["Added Time"].timestamp * 1000)
const channel = collection.string_map_data.Name.value
if (!data[url]) {
data[url] = { channel, tags: [], time, name }
}
if (tag && !data[url].tags.includes(tag)) {
data[url].tags.push(tag)
}
})
const csv = jsonToCSV(data)
const outputPath = path.replace(".json", ".csv")
writeFileSync(outputPath, csv)
}
const path = "./saved_collections.json"
instagramCollectionToCSV(path)
Importing the csv
file onto Notion