Archiving Catherine’s Instagram

I’ve been working on a way of keeping the photos and videos in Catherine’s Instagram online without Instagram, and finally came up with a solution today, which you can browse to your heart’s content at:

http://eramosa.net/instagram

Catherine posted to Instagram for four years, from December of 2015 to December of 2019. She started and ended in the Christmas season, and so both her first video and her last video were of the Christmas village that gets set up in our dining room every year.

To generate this static HTML version, I started with a data dump requested from Instagram, and wrote a short PHP script to process the media.json file found therein, which contains an index of every photo, video and story in the archive.

The script first loads in the JSON file and converts it to a PHP object:

$media_file = file_get_contents("media.json");
$media = json_decode($media_file);

Then it generates a thumbnail image, using ImageMagick, for every image, and writes the HTML needed to render that image, and link to the original:

fwrite($fp, "<h2>Photos</h2>\n");
foreach($media->photos as $key => $photo) {
	$html = "<a href='" . $photo->path . "'><img src='thumbnails/" . $photo->path . "' width='200' height='200' alt='" . htmlentities($photo->caption, ENT_QUOTES) . "' title='" . htmlentities($photo->caption, ENT_QUOTES) . "'></a> ";
	fwrite($fp, $html . "\n");
	$parts = explode("/", $photo->path);
	$subdir = $parts[1];
	if (!file_exists("thumbnails/photos/$subdir")) {
		system("mkdir thumbnails/photos/$subdir");
	}
	if (!file_exists("thumbnails/" . $photo->path)) {
		system("convert " . $photo->path . " -resize 200x200 thumbnails/" . $photo->path);
	}
}

It goes through the same process for the videos and stories, the result being one big index.html that shows everything. A sort of anti-Instagram, UX-wise.

I uploaded this file, along with the generated thumbnails and the photos, videos and stories directories, to an Amazon S3 bucket, wired up Catherine’s eramosa.net domain name to the bucket and, presto, static website.

Screen shot of Catherine's static Instagram archive.

Comments

Frances's picture
Frances on April 25, 2020 - 22:47 Permalink

The text is missing. Will you be archiving what Catherine wrote with her pictures?

Peter Rukavina's picture
Peter Rukavina on April 26, 2020 - 08:14 Permalink

The text is there: hover your mouse pointer over any image and you should see it pop up.

Frances's picture
Frances on April 26, 2020 - 10:27 Permalink

Thank you, that works on the laptop. Is the date stamp hidden?

Susan White's picture
Susan White on April 26, 2020 - 12:52 Permalink

I have enjoyed looking at these photos. Catherine was an amazing artist!

Cindy Hanson's picture
Cindy Hanson on April 26, 2020 - 18:08 Permalink

What a lovely collection! I’m relatively new to instagram and had not seen most of these pictures. It’s such a great archive of her material artwork and love of travel. Thanks for doing this