Sign inSign up

tenseiken/instaloader

By tenseiken

•Updated about 2 years ago
Archived

Unofficial containerized version of Instaloader: https://github.com/instaloader/instaloader

Image
Networking
0

415

tenseiken/instaloader repository overview

⁠Archive Notice

I am archiving this repo because Instaloader doesn't seem to work anymore as a set-and-forget cron job, which is the purpose of this repo, due to the its automated activity being so readily detectable. There does not seem to be any interest in fixing this (if that's even possible now) by the developers, so I will not be putting any more energy into it.

⁠Overview

Unofficial containerized version of Instaloader⁠. Based on python:3.12.4-bookworm⁠.

Uses an uncommitted rate limit fix from here⁠. This fix adds a random (15-30s) pause between queries which slows things down a lot, but should prevent your account from being suspended.

⁠Environment Variables

The only required environment variables are HOST_UID and HOST_GID. These are needed to make sure the downloaded files have the right permissions. You can specify your local timezone in TZ so the logging matches your local timezone.

NameDescriptionRequired?
HOST_UIDUID of the host account: id -uRequired
HOST_GIDGID of the hsot account: id -gRequired
TZYour local timezone value so that log date/time matches your local date/time. Uses tzdata format like America/New_York.Optional

⁠Volumes

You need to provide 2 volumes:

Path in ContainerDescriptionRequired?
/root/downloadThis is where all of your files will be downloaded. My advice would be to use an otherwise empty folder, just for this purpose.Required
/root/.config/instaloaderThis is where your configuration and session files are saved.Required

⁠Config Files

You need to provide 2 config files:

VolumeNameDescriptionRequired?
Configargs.txtThis file includes all of the parameters that will be passed to instaloader, one parameter per line. Don't include target usernames. More info found here⁠.Required
Configtargets.txtThis file includes all of the target user accounts you want to download, one username per line, exactly as it appears in the URL.Required

⁠args.txt Info

Format example:

--login=myusername
--password=myp@55w0rd
--abort-on=302,400,401,429
--fast-update
--quiet
  • --login and --password are always required, even after you have a session file saved. The script removes your existing session file after each full run. That seems to help with the next run.
  • --abort-on causes the scraper to stop immediately if it encounters any of a comma-separated list of HTTP response codes.
  • --fast-update causes the scraper to stop as soon as it sees a file that already exists. Take that part out if you need to do a full run, but if you're just getting updates, this will speed things up a lot.
  • --quiet reduces log output, only shows errors.

⁠targets.txt Info

Format example:

snoopdogg
thedodo
espn

⁠More About the Process

When you start the container, a script is started that runs the entire process. Here's how it works, step by step.

  • If you didn't properly provide args.txt and/or targets.txt it will stop right away. Consult your logs and make sure you've created args.txt and targets.txt in the config volume.
  • Reads the contents of targets.txt and stores it in memory.
  • Iterates the list of targets and runs instaloader, using the provided arguments in args.txt, individually for each user.
  • If instaloader fails for any user, you will get an error message. It's best not to auto-retry because usually these errors are about the profile being missing or you've been caught by the site for scraping, etc.
  • Once all of the users in targets.txt have been downloaded, your existing session file is removed. A new one will be created at the start of your next run. Having a fresh session seems to help a run go all the way through without errors.
  • File ownership and permissions for the entire /root/download directory are set.
  • After permissions are set and the total runtime is displayed, the process exits and the container will stop. You can start the container up again with a cron job on your local host to keep your local archive updated automatically.

Tag summary

Content type

Image

Digest

sha256:e1ac7b663…

Size

371.5 MB

Last updated

about 2 years ago

docker pull tenseiken/instaloader