Import Instagram archive to a Bluesky account
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix image upload - check bsky image number limit - fix mimetype conversion.

+8 -2
+8 -2
app.ts
··· 132 132 const mediaFilename = `${process.env.ARCHIVE_FOLDER}/${postMedia.uri}`; 133 133 const imageBuffer = FS.readFileSync(mediaFilename); 134 134 135 + if( j>3 ) { 136 + console.warn("Bluesky does not support more than 4 images per post, excess images will be discarded.") 137 + break; 138 + } 139 + 140 + 135 141 if (!SIMULATE) { 136 142 const blobRecord = await agent.uploadBlob(imageBuffer, { 137 143 encoding: mimeType ··· 142 148 image: { 143 149 $type: "blob", 144 150 ref: blobRecord.data.blob.ref, 145 - mimeType: mimeType, 151 + mimeType: blobRecord.data.blob.mimeType, 146 152 size: blobRecord.data.blob.size 147 153 } 148 154 }) ··· 188 194 189 195 if (SIMULATE) { 190 196 // In addition to the delay in AT Proto API calls, we will also consider a 10% delta for image upload 191 - const minutes = Math.round((importedMedia * API_DELAY / 1000) / 60) * 1.10 197 + const minutes = Math.round(((importedMedia * API_DELAY / 1000) / 60) * 1.10) 192 198 const hours = Math.floor(minutes / 60); 193 199 const min = minutes % 60; 194 200 console.log(`Estimated time for real import: ${hours} hours and ${min} minutes`);