TL;DR – Code available on GitHub here.
Few weeks ago my uncle told me that he was unable to receive any new emails. A quick investigation led us to the idea that he had no more space left in his Google account, and that was caused by the hundreds and hundreds of photos and videos he was taking, that were automatically being backed up to Google Photos service.
So the solution was simple, all he had to do is deleting some of the old photos to clear some space. but simple as that sound at first, turned out it wasn’t that an easy task after all.
While Google Photos easily and automatically uploads all your photos and videos, removing the files is a hard, Sisyphean task.
The closest available solution online is to manually select a range by holding Shift button, then scroll a little and select more. And while this is fine when you have few hundreds of photos, when you deal with tens of thousands of photos this doesn’t hold water.
Since I couldn’t find an automatic solution to the process. I’ve decided to use some of my spare time to write some script to automate the it.
How does it work?
The script is pretty simple. It selects all available photos/videos on the visible page, then scrolls down the page and repeats this process, until it arrives at the requested limit.
How to use it?
My solution is a JavaScript snippet that you should execute on Google Photos page. so if you’re familiar with web development just grab the code here.
For those who aren’t familiar with JavaScript:
- Grab the code from here. just select all the the content of the file and copy it. then browse Google Photos and wait for the page to load.
- Press
Ctrl+Shift+J
(orCommand+Shift+J
on MacOS) on your keyboard to open the Console and press anywhere on the console to change focus from the page itself to the newly opened console - paste the content of the script you just copied into the console and press Enter to execute the code.
What we just did was to define the function of selecting the photos/videos. - On the console now type :
selectPhotos(300, 'any');
make sure to replace 300 with the number of photos limit you want to select. if you wish to select photos or videos only, you can replace ‘any’ with ‘photos’ or ‘videos’, respectively.
Now just press Enter again and let the magic (code) begin 🙂
I really hoped I saved some people’s time and frustration. If you have any questions on how the code works i’d be happy to answer, and as always I’m glad to have pull requests.
Dor.
Pingback: Links 15/4/2020: GNU Guix 1.1.0, Oracle Solaris 11.4 SRU20 | Techrights
This saved me time thank you 🙂
Running Chrome 95.0.4638.69 (Official Build) (x86_64) on Mac I ran into a problem where I needed to scroll past photos for the selection to actually happen. But it was still much faster to do that than to try to shift select at whatever the arbitrary limit seemed to be.