Files
Tirsvad f4d8b41cdf
TirSystem/git-workflows: OpenGrep / opengrep (push) Skipped
TirSystem/git-workflows: Sync GitHub mirror metadata / sync-metadata (push) Skipped
TirSystem/git-workflows: Publish accepted milestones / publish (push) Skipped
TirSystem/git-workflows: Validate / validate (push) Skipped
TirSystem/git-workflows: Validate / validate (pull_request) Successful in 36s
TirSystem/git-workflows: Publish wiki / publish-wiki (push) Skipped
TirSystem/git-workflows: OpenGrep / opengrep (pull_request) Successful in 5m13s
Add lecture-step screenshots and README steps (MIL-003)
Task: MIL-003#1
2026-11-04 12:34:35 +08:00

6.4 KiB

🚀 Instagram Followers

A Python Selenium bot from Day 52 of Udemy's "100 Days of Code: The Complete Python Pro Bootcamp": it logs in to the Share-a-Naan mock service, opens a target account and follows each of its followers. It is for course participants who want readable, runnable code and for visitors looking for ideas.

📚 Table of Contents

🧭 Overview

The assignment has five steps: get credentials, create the InstaFollower class, log in, find the followers of the target account and follow them. The code keeps the assignment's names (InstaFollower, login, find_followers, follow).

  • src/instagram_followers/ holds the bot in clean-architecture layers (domain, application, infrastructure, presentation) and constants.py.
  • tests/ holds the pytest tests, which use a fake driver and need no browser or network.
  • docs/ holds the project documents and the wiki (English, Danish and Bahasa Malaysia).

The bot targets the mock service Share-a-Naan. Running bots against the real Instagram can get an account banned and is not supported.

Lecture steps

Each step of the assignment, with what the screen looks like on the Share-a-Naan mock. Screenshots were taken on 2026-11-04.

Step 1 - Get your credentials. The mock's profile page lists your login (your email is the username) and the target accounts to pick SIMILAR_ACCOUNT from. The password is read from the environment and never stored in the repository.

Target accounts on the Share-a-Naan profile page

Step 2 - Create a class. InstaFollower creates the Selenium driver in __init__ and has the three methods login(), find_followers() and follow().

Outline of the InstaFollower class

Step 3 - Log in. The login page, then two pop-ups that are dismissed with the "Not Now" button, found by its text with contains().

Share-a-Naan login page Save your login info pop-up Turn on notifications pop-up

Step 4 - Find the followers. Open /u/<account>, click the followers link and scroll the list inside the modal (the followers-scroll element), not the page behind it.

Profile of the target account Followers modal Followers modal scrolled to the end

Step 5 - Follow all the followers. Click every "Follow" button with a 1 second pause. If a click is intercepted by the "Unfollow?" pop-up (an account that is already followed), click "Cancel" and carry on.

Unfollow pop-up with a Cancel button Followers after the follow loop

📋 Requirements

  • Python 3.13 or newer.
  • Google Chrome (Selenium 4 downloads a matching driver by itself).
  • A Share-a-Naan account from the mock dashboard (https://app.100daysofpython.dev/).

🛠️ Setup

Create and use a local virtual environment named .venv, then upgrade pip and install the project with its test tools.

python -m venv .venv

Activate it (Windows PowerShell: .venv\Scripts\Activate.ps1; Git Bash, Linux, macOS: source .venv/bin/activate or source .venv/Scripts/activate).

python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

Credentials are read from environment variables, never from the code. Do not commit a .env file; it is ignored by git.

export INSTA_USERNAME="your_email"
export INSTA_PASSWORD="your_password"

▶️ Run

python -m instagram_followers.presentation.main

Run it sparingly and log out between test runs by hand. The mock has a "Reset Share-a-Naan" button on its profile page that clears your follows for a clean re-run.

🧪 Tests

python -m pytest

API documentation can be generated with doxygen Doxyfile (output in docs/doxygen/).

📄 License

AGPL-3.0, see LICENSE.

📎 Appendix: Project documents

The documents a newcomer needs, in reading order.

Document What it tells you
AGENTS.md The rules AI agents follow in this repository
Business Case Why the project exists, its scope and success criteria
Stakeholder Analysis Who is involved; the stakeholder IDs used for owners and reviewers
Project Plan The gateways and their schedule
Milestones One document per gateway: Go/No-Go criteria and tasks
Artifact registry Where each artifact type lives, the next version, the PO language and domain
Domain dictionary The PO terms and the IT terms
Traceability matrix How the artifacts link and when each was last reviewed
Framework README The framework this project uses
Framework changelog What changed in each framework release