Last active
March 6, 2024 10:35
-
-
Save AshKyd/c1e21f81c3992096c93311d728ef353f to your computer and use it in GitHub Desktop.
Delete photos, videos, and reviews from the Google Maps desktop site. Huge disclaimer: these will probably get out of date at some point and may not work. You should read and understand the code before you do anything with it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// delete photos from Google Maps | |
(async () => { | |
const sleep = (time) => new Promise(resolve => setTimeout(resolve,time)); | |
const go = async () => { | |
// click the kebab | |
document.querySelector('button[jsaction*="pane.photo.actionMenu"]:not([aria-hidden="true"])').click(); | |
await sleep(200); | |
// click the delete menu item | |
document.querySelector('#action-menu div[role="menuitemradio"]').click(); | |
await sleep(200); | |
// click the "yes I'm sure" button | |
document.querySelector('div[aria-label="Delete this photo?"] button+button,div[aria-label="Delete this video?"] button+button').click(); | |
await sleep(1500); | |
// check if there's any left, and do it all again | |
if(document.querySelector('button[jsaction*="pane.photo.actionMenu"]:not([aria-hidden="true"])')) go(); | |
} | |
go(); | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// delete reviews from Google Maps | |
(async () => { | |
const sleep = (time) => new Promise(resolve => setTimeout(resolve,time)); | |
const go = async () => { | |
// click the kebab | |
document.querySelector('button[jsaction*="review.actionMenu"]:not([aria-hidden="true"])').click(); | |
await sleep(300); | |
// find the delete review menu item | |
const deleteMenuItem = document.querySelector('#action-menu div[role="menuitemradio"]+div'); | |
if(deleteMenuItem.textContent.trim() !== 'Delete review') return console.error('wrong menu item', deleteMenuItem.textContent); | |
deleteMenuItem.click(); | |
await sleep(300); | |
// click the "yes I'm sure" button | |
document.querySelector('div[aria-label="Delete this review?"] button+button').click(); | |
await sleep(2000); | |
// check if there's any left, and do it all again | |
if(document.querySelector('button[jsaction*="review.actionMenu"]:not([aria-hidden="true"])')) go(); | |
} | |
go(); | |
})() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment