Skip to content

Instantly share code, notes, and snippets.

@JohnDinhDev
Last active April 29, 2024 18:36
Show Gist options
  • Save JohnDinhDev/330df494981ca97c92a95b65e28967d3 to your computer and use it in GitHub Desktop.
Save JohnDinhDev/330df494981ca97c92a95b65e28967d3 to your computer and use it in GitHub Desktop.
Reset Udemy Progress

Reset Udemy Progress

Last Updated: 09/30/2022

Step 1. Go to Udemy course in browser

Go to the course and have any video up. The following code relies on the right sidebar to be visible to uncheck all your progress.

Step 2. Open browser console

You can do this with ctrl+shift+j and making sure the console tab is selected for chrome/brave

For FireFox, use ctrl+shift+i and select the console tab

Step 3. Run code in browser console

Copy and paste this code in the console Hit the enter key to run

// Stores all unexpanded section headers, and clicks on the unexpanded section headers to expand them
const sectionEl = document.querySelectorAll("section[data-purpose='sidebar'] div.udlite-btn");
sectionEl.forEach((section) => {
  const isClosed = section.parentElement.querySelector("span").getAttribute("data-checked") !== "checked"
  if (isClosed) section.click()
});

// Stores all checkboxes on the page, and clicks on any checkboxes on that currently checked
const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
  if(checkbox.checked) {
    checkbox.click();
  }
})

Note that your Udemy progress % will not update back to 0%. This is on Udemy's server's end, which I can't control. If you start going through the course again, having a few sections checked off, the percentage should update accordingly.

If this helped you and you want to show your appreciation, consider buying me a coffee ☺ https://ko-fi.com/johndinhdev

@behroozhussaini
Copy link

that was magic! 💯

@ajaylakhimale
Copy link

it's returning "Undefined" now , and does not work !!

@ajaylakhimale
Copy link

that was magic! 💯

### Yah it's programming !!

@phuong-it
Copy link

phuong-it commented May 31, 2022

it's returning "Undefined" now , and does not work !!

updated 05/31/2022

const sectionEl = document.querySelectorAll("div[data-purpose='curriculum-section-container'] button[aria-expanded='false']");
sectionEl.forEach((section) => {
  section.click();
});

@thachnv92
Copy link

08 May 2022:
It works for me.
Thank you.

@codeepic
Copy link

codeepic commented Jun 9, 2022

This is gold! Saved me a ton of time!

@jlamb85
Copy link

jlamb85 commented Jun 17, 2022

This works perfectly if you are playing the first video and then run it

@MalcolmAnderson
Copy link

So incredibly awesome. Thank you.

@ankitchauhan-aka
Copy link

It Worked on 4-7-2022. 👍

@ibonet787
Copy link

It worked for me. Thanks!

@badredy
Copy link

badredy commented Aug 7, 2022

worked in Firefox after writing "allow pasting" in the console

@gaetangr
Copy link

Thanks, work on Chrome, reset all lessons and make the progression to 0% !

@ponchique
Copy link

Great job! Thank you! 🥦

@linubajy
Copy link

It Worked !Thanks !Saved lots of time :)

@Sagargajare
Copy link

Hey everyone,

I created a chrome extension using the above script.

https://chrome.google.com/webstore/detail/udemy-progress-reset-and/hfkchfjmlhncoaidcoondhaifllmcefj

you can reset udemy course progress in one click.

@somnathdas2008
Copy link

Hey everyone,

I created a chrome extension using the above script.

https://chrome.google.com/webstore/detail/udemy-progress-reset-and/hfkchfjmlhncoaidcoondhaifllmcefj

you can reset udemy course progress in one click.

Not working for udemy business
Error
2otBannerSdk.js:7 Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
at Er.setAriaLabelforButtonInFilter (otBannerSdk.js:7:319533)
at Er.toggleV2Category (otBannerSdk.js:7:334940)
at Er.toggleGroupORVendorHandler (otBannerSdk.js:7:333516)

@somnathdas2008
Copy link

The code does not work for Udemy Business, and it does not work for me. I try to use both Firefox and Chrome.

Error
Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
at Er.setAriaLabelforButtonInFilter (otBannerSdk.js:7:319533)
at Er.toggleV2Category (otBannerSdk.js:7:334940)
at Er.toggleGroupORVendorHandler (otBannerSdk.js:7:333516)
at :12:14
at NodeList.forEach ()
at :10:12

// Stores all unexpanded section headers, and clicks on the unexpanded section headers to expand them
const sectionEl = document.querySelectorAll("section[data-purpose='sidebar'] div.udlite-btn");
sectionEl.forEach((section) => {
const isClosed = section.parentElement.querySelector("span").getAttribute("data-checked") !== "checked"
if (isClosed) section.click()
});

// Stores all checkboxes on the page, and clicks on any checkboxes on that currently checked
const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(checkbox.checked) {
checkbox.click();
}
})

@Jakartoine
Copy link

Should be changed to this:

const sectionEl = document.querySelectorAll("div[data-purpose='curriculum-section-container'] button[aria-expanded='false']");
sectionEl.forEach((section) => {
section.click();
});

// Stores all checkboxes on the page, and clicks on any checkboxes on that currently checked
const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(checkbox.checked) {
checkbox.click();
}
})

@asr-repository
Copy link

There's a correction folks... Udemy updated some of their CSS classes recently to a reduced format. Meaning " div.udlite-btn" is now "div.ud-btn" The new code is as follows. Just copy and paste this one.. It should work just fine:

// Stores all unexpanded section headers, and clicks on the unexpanded section headers to expand them
const sectionEl = document.querySelectorAll("section[data-purpose='sidebar'] div.ud-btn");
sectionEl.forEach((section) => {
const isClosed = section.parentElement.querySelector("span").getAttribute("data-checked") !== "checked"
if (isClosed) section.click()
});

// Stores all checkboxes on the page, and clicks on any checkboxes on that currently checked
const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(checkbox.checked) {
checkbox.click();
}
})

@somnathdas2008
Copy link

Not Working Error below

Uncaught TypeError: null has no properties
setAriaLabelforButtonInFilter https://cdn.cookielaw.org/scripttemplates/202211.2.0/otBannerSdk.js:7
toggleV2Category https://cdn.cookielaw.org/scripttemplates/202211.2.0/otBannerSdk.js:7
toggleGroupORVendorHandler https://cdn.cookielaw.org/scripttemplates/202211.2.0/otBannerSdk.js:7
debugger eval code:12
debugger eval code:10
2 otBannerSdk.js:7:321773
setAriaLabelforButtonInFilter https://cdn.cookielaw.org/scripttemplates/202211.2.0/otBannerSdk.js:7
toggleV2Category https://cdn.cookielaw.org/scripttemplates/202211.2.0/otBannerSdk.js:7
self-hosted:1356
toggleGroupORVendorHandler https://cdn.cookielaw.org/scripttemplates/202211.2.0/otBannerSdk.js:7
debugger eval code:12
forEach self-hosted:203
debugger eval code:10
getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:242
evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:166
evaluateJS resource://devtools/server/actors/webconsole.js:1131
evaluateJSAsync resource://devtools/server/actors/webconsole.js:1022
makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103

@SandorGyorgy
Copy link

Expand all sections by hand and run this :
const sectionEl = document.querySelector("section[data-purpose='sidebar']"); const checkboxes = sectionEl.querySelectorAll("input[type='checkbox']"); checkboxes.forEach((checkbox) => { if (checkbox.checked) { checkbox.disabled = false; checkbox.click(); } });

@somnathdas2008
Copy link

Awesome It works. Thank you so much. @SandorGyorgy

@akaluzinski
Copy link

Thanks guys! It's real time saver!

@Meenakshi-Dangi
Copy link

Thank you so much.
I am new to programming and finding it fascinating..... :-)
Programming can do miracles...!

@irfanbaigse
Copy link

irfanbaigse commented Dec 13, 2023

Working

Expand all sections

const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(checkbox.checked) {
checkbox.click();}})

Mark as Complete

const sectionEl = document.querySelector("section[data-purpose='sidebar']"); const checkboxes = sectionEl.querySelectorAll("input[type='checkbox']"); checkboxes.forEach((checkbox) => { if (!checkbox.checked) { checkbox.disabled = false; checkbox.click(); } });

@IsraeLucena
Copy link

IsraeLucena commented Jan 21, 2024

const sectionEl = document.querySelector("section[data-purpose='sidebar']"); const checkboxes = sectionEl.querySelectorAll("input[type='checkbox']"); checkboxes.forEach((checkbox) => { if (checkbox.checked) { checkbox.disabled = false; checkbox.click(); } });

It works for me!

However, please be mindful to expand all sections before running the script.

@kavehtehrani
Copy link

Working

Expand all sections

const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(checkbox.checked) {
checkbox.click();}})

Mark as Complete

const sectionEl = document.querySelector("section[data-purpose='sidebar']"); const checkboxes = sectionEl.querySelectorAll("input[type='checkbox']"); checkboxes.forEach((checkbox) => { if (!checkbox.checked) { checkbox.disabled = false; checkbox.click(); } });

Awesome thank you.

@ekrishnas
Copy link

Awesome thank you.

@596050
Copy link

596050 commented Apr 14, 2024

To open all sections:

$x("/html/body/div[1]/div[1]/div/div/main/div/div[2]/section/div[2]/div/div/div/div[1]").map(el => el.click())

To uncheck all checkboxes:

const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(checkbox.checked) {
checkbox.click();}})

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