An offline web page to view a Mastodon archive. It gives a powerful data table to tell you what the composition of all your toots is. There is also a line graph telling you the tooting trend. You can select a period of time to view.
The branch “exhibition” is for my season’s toots exhibition.
captionText
is not defined: var captionText = document.getElementById("caption");
archive-xxx.tar.gz
file anymore, just select directly the archive file in browser, then everything should be fine. This feature benefits from pako and js-untar, which are greatly appreciated. (and this code provides an out-of-the-box idea)likes.json
and bookmarks.json
don’t have a link formated as https://<mastodon.example.com>/users/<username>/statuses/<status_id>
, they are like https://<pleroma.example.com>/objects/<object-id>
. It is not fair to exclude them.Simply put, just request your Mastodon archive and download it, save this repo, open the archive_page.html
web page in your browser and choose your archive, there you go.
First go to your Mastodon instance, request an archive of your toots and uploaded media (Settings - Import and export - Data export), and download your archive. Then:
$ git clone https://github.com/zero-mstd/mav-z.git
$ cd mav-z
$ firefox archive_page.html
Code
;Download ZIP
;mav-z-master.zip
) and enter this folder;archive_page.html
in your browser;.tar.gz
archive file you got from the 1st step.This web page tool can automatically decompress the archive-xxx.tar.gz
file for you, and it will store all the decompressed files in memory (RAM) temporarily. For reference, my archive file is about 200 MB and it will take 5 seconds to finish all the works.
If your archive file is too big (I don’t know, maybe > 1000 MB), your browser may get stuck. In this case, using the manual mode is a good idea, i.e., unzipping the archive file manually by yourself. In order to display media files correctly, you should copy and paste your files so that your directory tree is like:
./
├── actor.json
├── archive_page.html
├── assets
│ ├── avatar.png
│ ├── chart.js
│ ├── favicon.ico
│ ├── header.jpg
│ ├── main.js
│ ├── pako.min.js
│ ├── style.css
│ ├── translator.js
│ └── untar.js
├── avatar.{jpg|png|…}
├── bookmarks.json
├── header.{jpg|png|…}
├── likes.json
├── media_attachments
│ └── files
│ ├── ……
│ └── ……
└── outbox.json
Now you can open the archive_page.html
in your browser, choose manually
in the Loading mode
drop-down menu, then follow the instructions, choose and open the four .json
files one by one. actor.json
must be loaded before outbox.json
, while bookmarks.json
and likes.json
are optional.
If your toots are not arranged completely in chronological order, as shown below, this may be caused by some kind of unknown bug. (If you can figure it out please let me know.)
Here is the workaround: open and edit the assets/main.js
, go to line 431 and remove the first two slashes.
/* 428 */ var statuses = outbox.orderedItems.map(item => item.object)
/* 429 */ .filter(object => typeof(object) === typeof({}));
/* 430 */ // Uncomment the following line to sort your toots by published time.
/* 431 */ statuses = statuses.sort((a,b) => new Date(a.published).getTime() - new Date(b.published).getTime());
/* 432 */ debugLog("(log)(build) turned outbox.orderedItems to statuses");
By the way, if you want to view your toots in reverse order, edit line 431 like this (exchange a
and b
in the first bracket):
/* 431 */ statuses = statuses.sort((b,a) => new Date(a.published).getTime() - new Date(b.published).getTime());
The line graph function depends on chart.js, whose support for older browsers got dropped a while back. Thus, this tool supports:
If your browser doesn’t meet the minimum version number mentioned above, you should get error like “ReferenceError: ResizeObserver is not defined”. If this happens, upgrading your browser is always the best choice. But if you can’t upgrade for some reasons, you can also delete line 336 and line 338 in archive_page.html
:
<!--336--> <!--
<!--337--> <script type="text/javascript" src="./assets/polyfillResizeObserver.js"></script>
<!--338--> -->
If you run into other problems, here’s what you can do:
assets/main.js
;var debug = 1;
, which means you turn on the debug mode;archive_page.html
in browser;F12
button and go to the console
tab, make sure you have already seen the log “debug mode on”;addEventListener click
didn’t work…)actor.json
and outbox.json
respectively, no support to media (images or vedios).outbox.json
file into .csv
file then can be viewed in excel or other softwares.Open to suggestions. Chinese and English ok.