An open API service indexing awesome lists of open source software.

https://github.com/pmiddend/twitter-backup-to-markdown

Convert your old (2022) Twitter backup tweets.json to Markdown
https://github.com/pmiddend/twitter-backup-to-markdown

Last synced: 10 months ago
JSON representation

Convert your old (2022) Twitter backup tweets.json to Markdown

Awesome Lists containing this project

README

          

# twitter-backup-to-markdown

## Rationale

If you left Twitter (now X) around 2022, you got a `.zip` file containing basically a whole web site that you can open in the browser to view your tweet history. Here's an excerpt from the zip file contents:

```
data/
data/README.txt
Your archive.html
assets//
assets/images//
assets/images/groupAvatar.svg
assets/images/favicon.ico
assets/images/twemoji//
assets/images/twemoji/v//
assets/images/twemoji/v/latest//
assets/images/twemoji/v/latest/svg//
assets/images/twemoji/v/latest/svg/1f9b9-1f3fe-200d-2640-fe0f.svg
assets/images/twemoji/v/latest/svg/1f9dc-1f3fe-200d-2640-fe0f.svg
assets/images/twemoji/v/latest/svg/2198.svg
assets/images/twemoji/v/latest/svg/1f9b6-1f3fd.svg
assets/images/twemoji/v/latest/svg/1f9db-1f3fb.svg
assets/images/twemoji/v/latest/svg/1f9d1-1f3fc-200d-1f91d-200d-1f9d1-1f3fc.svg
assets/images/twemoji/v/latest/svg/1f449-1f3fb.svg
assets/images/twemoji/v/latest/svg/1f44e-1f3fc.svg
...
```

This is, of course, totally fine. But in my case, I wanted a single Markdown (md) file that contained all Tweets. I also didn't care much about linked images. I just wanted the text. And I wanted to learn Rust. So I wrote this tool.

## Usage

From your `.zip` file, take the `data/tweets.js` file and cut off everything until the `[` character. For me it looked like this:

```javascript
window.YTD.tweets.part0 = [
{
"tweet" : {
"edit_info" : {
...
}
...
```

This is Javascript. We want JSON. So afterwards it looked like this:

```json
[
{
"tweet" : {
"edit_info" : {
...
}
...
]
```

Save it under `tweets.json` inside this repository. Then install `cargo` and run:

```
cargo run
```

It will spit out the Markdown on the standard output, so you might want to do this instead:

```
cargo run > output.md
```

And voila!