you will need Powershell installed. Windows comes pre-installed with Powershell 5; that's fine. most linux distros package powershell for you, don't give me that look.
if you are familiar with git, you can git clone this repo. if you are not familiar with git, the powershell script is standalone and needs no other files. you can download it directly from here (click "Download raw file" near the right toolbar).
(i can't give a direct link unfortunately because Windows tries to save it as a .txt file 😔)
the entrypoint is the powershell script; pass it your cohost handle
./extract.ps1 jyn
if you don't know what the ./
symbols mean, you can also right click the script in Windows Explorer and click 'Run with Powershell'; it will prompt you for your username.
if that does nothing and exits, you likely have powershell scripts blocked (this is the default). do the following things:
- right click on the folder and click 'Open in Terminal'
- run
powershell.exe -noprofile -executionpolicy bypass -file .\extract.ps1
the script will create this directory structure:
PS C:\Users\jyn\src\cohost-backup> tree
Folder PATH listing
C:.
├───img
├───likes
│ ├───parsed
│ ├───raw
│ └───rendered
└───posts
├───parsed
├───raw
└───rendered
the files you care about are in rendered
. there will be a lot of them, especially in likes
.
the first run will take longer because it downloads a bunch of images. after that it just has to ensure the rendered JSON and .md files are up to date, so it should be faster.
you can use any markdown renderer; i like obsidian.
you also have the option to use the Show-Markdown
commandlet built into powershell.
there is a previous version in bash but i consider it unmaintained and will probably delete it eventually. run it with ./extract.sh username
.
feel free to change it lol, look around Format-Post
i am considering consolidating the posts into one giant amalgamation, but haven't thought of an appropriate separator between posts yet.
if you want to port it to cohost.py, be my guest. i'm not gonna bother.