Mirroring Instagram accounts **will copy (clone) the images and videos from Instagram** to your server, thus moving the data sovereignty to you as an Admin.
Always make sure you mirror accounts whos **content is not strictly copyrighted (or branded) and keep the tagging system of the source code** that marks accounts on Pixelfed as Mirrors.
**Users** of your Pixelfed instance have to know **this accounts are not real accounts** as someone on Instagram could create a real Pixelfed account in the future.
3. Copy `config.json.example` to `config.json` and configure to your needs. Make sure you **remove the comments from the file** because Python doesn't like them.
4. Copy `scripts/user_create.example` to `scripts/user_create`. This script runs the `php artisan user:create` command with the given positional parameters to **automatically create local Pixelfed accounts** with forced email verification. **Adapt to your needs**.
5. [Log in](https://www.instagram.com) to your Instagram account on a **Browser** (with remember ticked ON), **open your browser's developer console at "Network" tab**, navigate throught IG a bit and **copy the Request Headers** of any request done to _instagram.com_. Make sure there is `X-IG-App-ID, X-IG-WWW-Claim, Cookie` headers set.
```bash
# create a new headers file on "headers/" on your working directory
# you can view an example at "headers.example" file
vim headers/1.txt
# FILE EDITING
# ----
# 1. Add the headers you copied from the browser.
# 2. Keep only the "X-IG-App-ID, X-IG-WWW-Claim, Cookie" headers,
# "User-Agent" might be also good to keep (to match the browser)
# (It uses a common User-Agent by default)
# -
# Done editing
```
Create as much headers TXT files as you wish. It will be **used randomly on requests to Instagram** by the mirror bot.
**Add a new Instagram account to mirror**. This is done **syncronously until it finishes adding** account information, once it's done, it **calls update asyncronously**.
`curl 127.0.0.1:8080/<username>/add`
**Update Instagram account/s mirror** on Pixelfed (mirrors new content). This is **done fully asyncronously**
```bash
# Update just the given account
curl 127.0.0.1:8080/<username>/update`
# API supports wildcard to update all accounts mirrors
curl '127.0.0.1:8080/*/update'`
```
**Log in or log out** the account from Pixelfed.
```bash
curl 127.0.0.1:8080/<username>/login
curl 127.0.0.1:8080/<username>/logout
```
In case of repeated posts or disaster, **prune/nuke all Pixelfed posts** from the given account.
`curl 127.0.0.1:8080/<username>/nuke`
## Automatically updating posts of mirrored accounts
You have to **create a cronjob or systemd timer** (or whatever scheduled) to run `curl '127.0.0.1:8080/*/update'`
Please consider **how many accounts you mirror** + **how often you want to update posts** + **how often you want to bother Instagram** servers... A good reference is **a job every 4 hours for more-or-less 20 accounts** to be "completely safe".
## Happy Mirroring!
Any problem/bug/request you might encounter **you may contact me** at https://contact.nogafam.es