AI • Science • Technology • Future

Side Projects

PhotoSweep: A Zero-OAuth Google Photos Bulk Cleaner

Image from the original article
Featured image: original publisher image. Via original publisher.

A few weeks ago, a user hit Google Photos’ 15GB storage limit. Gmail started warning about incoming email bounces. This common limit often pushes users to clean up old photos—especially screenshots, blurry images, and large videos. Source: dev.to.

Why Bulk Deletion in Google Photos Is a Pain Point

Google Photos has no native ‘Select All’ button. Users must use Shift-click to select photos. But this fails when the photo grid unmounts—causing tab freezes or accidental deletions.

Most bulk-delete tools are outdated. They don’t work on modern Google Photos or non-English interfaces. Some delete items without preview, increasing the risk of mistakes.

The official Google Photos Library API blocks deletion of third-party uploads. Requesting OAuth raises privacy concerns. Users rarely grant such access to background tools.

How PhotoSweep Solves These Problems

PhotoSweep is a lightweight extension built with plain Vanilla JavaScript and CSS. It has no backend, no external authentication, and no Google OAuth.

It lets users select, preview, and move photos to trash in bulk—without sending any data outside their browser. This makes it a privacy-first tool for managing large photo libraries.

Key DOM Engineering Challenges

Finding the Right Scroll Container

Google Photos doesn’t scroll the browser window. The photo grid lives inside a container with class ‘c-wiz’ and role ‘main’.

Scrolling the first overflow-y: auto element fails—it scrolls the sidebar instead. The solution uses bounding-box width and height to find valid containers.

PhotoSweep drives virtual list loading with scrollBy, scrollIntoView, and simulated WheelEvent actions. This ensures smooth, accurate photo loading.

To detect the end of the library, it checks three signals: scroll offset delta, timeline scrubber value (via aria-valuenow), and new photo links (a[href*=’/photo/’]) in the DOM.

Hidden Checkboxes and Date-Header Traps

Photo checkboxes are hidden with opacity: 0 until hovered. Standard visibility checks miss them—leading to incomplete selections.

Each date group has a ‘select entire day’ checkbox. Accidentally clicking it selects all photos for that day. The tool avoids this by checking aria-label and parent heading.

Event Pipeline Flakiness

Google Photos uses jsaction event delegation. A simple .click() call often fails to trigger actions.

Image from the original article
original publisher image. Via original publisher. · Source

PhotoSweep mimics real user input with a full mouse sequence: pointerdown → mousedown → pointerup → mouseup → click. This improves reliability.

It includes configurable delays (100–500ms) and batch sizes (25–100) to keep the tab smooth, even with large libraries.

Multi-Language Trash Detection

Older tools fail on non-English interfaces. PhotoSweep uses a three-layer fallback:

  1. A dictionary of aria-labels and tooltips for 11 languages: English, Spanish, Japanese, Chinese, French, German, Korean, Portuguese, Russian, Italian, and more.
  2. Matching the SVG path of the Material Design trash icon in the top action bar—consistent across languages.
  3. Dispatching the native keyboard shortcut: # or Delete—works everywhere.

When a confirmation dialog appears, the script waits up to three seconds for ‘ok’ or localized labels. If no dialog shows, it pauses—preventing out-of-sync actions.

Safety and User Controls

PhotoSweep starts in Dry-Run mode. Selected items appear with a blue border. No deletion happens until you switch to ‘Auto Move to Trash’.

All photos are moved to Google Photos Trash—never deleted permanently. The tool skips starred photos and lets you set a cutoff year (e.g., 2024 and older).

Privacy and Technical Limits

PhotoSweep only requests storage, activeTab, and access to photos.google.com. No credentials, metadata, or personal data leave your browser.

Users should disable mobile backup and sync in their phone’s Google Photos app. Deleting cloud photos may remove local copies on their phone.

How to Try It and Get a Free Pro Code

PhotoSweep is available on the Microsoft Edge Add-ons Store. Visit https://qzm12348.github.io/photosweep/ for the full landing page and privacy policy.

The first 199 DEV Community readers get a free Lifetime Pro code. Email 9090qzm@gmail.com with subject ‘PhotoSweep Pro’—no strings attached.

Feedback is deeply appreciated. Honest reviews on the Edge Add-ons Store help a solo developer. If you find bugs or missing features, share them in the comments. Google frequently updates the DOM, so your input is vital.

PhotoSweep includes 500 free items per day (reset at midnight). All features—Dry-Run, Skip Starred, and Cutoff Year—are unlocked. A $4.99 one-time Pro unlock lets you delete tens of thousands of old photos at once.

For more on browser-based automation, see Local File Conversion in Browser. For media processing in the browser, explore Compress a Photo to Exactly 50KB in Your Browser. For privacy tools, see Yonder: A Free, Open-Source Eye Break Tool.

Sources & further reading

Featured image: original publisher image. Via original publisher. Image source