Skip to content

spyatmycode/Java-Snapchat-Streak-Automator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔥 Snap Streaker

Automated Snapchat streak maintenance using Selenium WebDriver

A Java-based automation tool that programmatically maintains Snapchat streaks through browser automation. Built out of necessity when manually sending daily snaps to 20+ friends became unsustainable.

The Problem

Like every 21 year old, I got overwhelmed with responsiblities and kept forgetting the yellow app.

Snapchat streaks require sending snaps to friends every 24 hours. Miss a day? Lose a streak you've maintained for months (or years). With multiple streaks to maintain, this becomes a daily chore that takes 5-10 minutes of mindless tapping.

The Solution

This bot automates the entire flow:

  1. Logs into Snapchat Web
  2. Handles dynamic modals and popups
  3. Accesses the camera (using a fake media stream)
  4. Takes a snap
  5. Selects all streak contacts
  6. Sends the snap

Result: What took 10 minutes of manual work now runs in ~2 minutes, completely unattended.


Tech Stack

Technology Purpose
Java 17 Core application logic
Selenium WebDriver Browser automation and DOM interaction
Maven Dependency management and build lifecycle
Docker Containerized deployment with multi-stage builds
Chrome Headless Undetectable browser automation

Technical Highlights

Fluent Builder Pattern

The API uses method chaining for readable, expressive automation flows:

streaker.open()
        .login(email, password)
        .checkForModals()
        .camera()
        .snap()
        .streak()
        .send()
        .log()
        .quit();

Anti-Detection Measures

Modern websites detect and block Selenium. This implementation bypasses detection through:

  • Custom User-Agent strings mimicking real browsers
  • Disabling the AutomationControlled Blink feature
  • Excluding automation switches from Chrome options
  • Fake media stream injection for camera access
options.addArguments("--disable-blink-features=AutomationControlled");
options.setExperimentalOption("excludeSwitches", List.of("enable-automation"));
options.addArguments("--use-fake-device-for-media-stream");

Resilient Element Location

Web UIs change frequently. The bot uses retry loops with implicit waits to handle dynamic content loading:

while (true) {
    try {
        element = driver.findElement(By.className("targetClass"));
        element.click();
        break;
    } catch (Exception e) {
        driverWait(2000);
    }
}

Containerized Deployment

Multi-stage Docker build keeps the final image lean:

  • Stage 1 (Builder): Maven image compiles and packages the JAR
  • Stage 2 (Runtime): JRE-only image with Chrome installed
FROM maven:3.9-eclipse-temurin-17 AS builder
# Build the fat JAR...

FROM eclipse-temurin:17-jre-jammy
# Install Chrome, copy JAR, run

Project Structure

streaker/
├── src/main/java/com/nifemi/
│   └── Streaker.java          # Main automation logic
├── pom.xml                    # Maven config with shade plugin
├── Dockerfile                 # Multi-stage containerized build
└── .gitignore

Setup & Usage

Prerequisites

  • Java 17+
  • Maven 3.x
  • Chrome browser (or Docker)

Running Locally

  1. Create a creds.txt file with your credentials:

    your_email your_password
    
  2. Build and run:

    mvn clean package
    java -jar target/streaker-1.0-SNAPSHOT.jar

Running with Docker

docker build -t snap-streaker .
docker run snap-streaker

Key Learnings

  • Browser automation at scale: Handling dynamic SPAs requires patience and defensive coding
  • Anti-bot detection: Understanding how sites fingerprint automation tools
  • Headless browser quirks: Fake media streams, viewport sizes, and permission handling
  • Docker multi-stage builds: Separating build-time and runtime dependencies

Disclaimer

This project was built for educational purposes and personal use. Automating interactions with third-party services may violate their Terms of Service. Use responsibly.


Author

Nifemi Akejuobi

Built because maintaining 20+ streaks manually every single day was getting old. 🙃

About

Automated Snapchat streak maintenance using Java and Selenium WebDriver

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages