Skip to content

Instantly share code, notes, and snippets.

@EldonMcGuinness
Last active April 12, 2025 11:07
Show Gist options
  • Save EldonMcGuinness/cbb211eb0be0023fb56e1dac2e8066e4 to your computer and use it in GitHub Desktop.
Save EldonMcGuinness/cbb211eb0be0023fb56e1dac2e8066e4 to your computer and use it in GitHub Desktop.
Set permission for apps on amazon kids+ content
// Goto https://parents.amazon.com/explore?selectedContentType=APP
// Edit this to fit your family, each line is a child in your kids+ family and the order
// here show match the order listed when you click on an item to enable / disable it.
const child_defaults = [
false,
false,
false,
false,
false,
];
// -1 Ready
// 0 Stopping
// 1 Stopped
let appRun = -1;
let previousItem = 0;
function stopApp( item ){
previousItem = item;
console.log("App Stopped");
appRun = 1;
}
function sleep(s) {
return new Promise(resolve => setTimeout(resolve, s*1000));
}
async function loadPages(){
try {
//while( document.querySelector(".pd-margin-top .css-n0loux") ){
console.log("Loading App Page");
(document.querySelector(".pd-margin-top .css-n0loux")).click();
await sleep(0.1);
while (document.querySelector('.css-6yd4xx')){
if ( appRun == 0 ){
break;
}
await sleep(0.1);
}
//}
}catch(e){
}
console.log("Done!");
}
async function closeWindow(){
try {
document.querySelector('#modal-description').parentElement.parentElement.firstChild.click();
}catch(e){
}
}
async function changeChildSetting(child, show){
const regex = ( show ) ? /hideButton/ : /showButton/;
try {
button = document.querySelector('#modal-description #pd-expl-detailcard-icon-'+child+' img');
if (button.src.match( regex )) {
button.click();
await sleep(0.3)
return true;
}
}catch(e){
}
return false;
}
async function clicker( startAt = 0) {
console.log("Starting App");
let currentItem = startAt;
let itemCount = 0;
// Get initial set of items
let items = document.querySelectorAll('.search-result-card-clickable');
itemCount = items.length;
while ( currentItem < itemCount ) {
if ( appRun == 0 ){
break;
}
console.log("Editing " + currentItem + " of " + itemCount );
let button = null;
let changed = false;
items[currentItem].click();
await sleep(0.25);
while( ! document.querySelector('#modal-description #pd-expl-detailcard-icon-0 img') ) {
if ( appRun == 0 ){
break;
}
await sleep(0.1);
}
// Loop through the children and mark them as noted in the child_defaults variable
// true = shown
// false = hidden
for ( child in child_defaults ){
let thisChanged = await changeChildSetting( child, child_defaults[child] );
if ( ! changed ) {
changed = thisChanged;
}
}
if (changed){
await sleep(1);
}else{
}
currentItem++;
closeWindow();
// Load more items
if ( currentItem == itemCount ) {
await loadPages();
items = document.querySelectorAll('.search-result-card-clickable');
itemCount = items.length;
//console.log("Count ["+currentItem+"]["+itemCount+"]");
}
}
stopApp(currentItem);
console.log("Done!");
}
document.addEventListener ("keydown", function (e) {
if (appRun == -1 && e.ctrlKey && e.altKey && e.key === "c") { // case sensitive
appRun = 0;
}
} );
document.addEventListener ("keydown", function (e) {
if (appRun == 1 && e.ctrlKey && e.altKey && e.key === "r") { // case sensitive
appRun = -1;
clicker(previousItem);
}
} );
clicker();
@Baenwort
Copy link

Baenwort commented Feb 8, 2025

Do you think this same technique would work for the other content types on Kids+?

@Fw-Franz
Copy link

Hi, thank you for this great tool! Unfortunately when I ran it, it finishes immediately but nothing happened. Is it possible Amazon changed the selectors and that's why the script can't find any apps to disable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment