shihabmridha / educative.io-downloader

Free Palestine. 📖 This tool is to download course from educative.io for offline usage. It uses your login credentials and download the course.
218 stars 129 forks source link

Downloader does not work #85

Open samarthasthan opened 6 months ago

samarthasthan commented 6 months ago

Hey, I am looking for Educative course downloader, i have educative premium account, but i am not able to find any educative downloader also your program is also not working, so can you help me in this? also i you want any course i will download it for you?

shihabmridha commented 6 months ago

Hi, I have migrated the project to run using the Bun runtime. Also fixed an issue with login regarding 2FA. Please install Bun in your computer. Then clone the project and run bun install to install the dependencies. Then open the config/default.json file and fill the email, password and courseUrl fields. Then run bun start and see if it works.

Side note: While checking authentication, you might get asked to input the OTP code sent via email. As soon as you input the OTP, the script should continue.

iamrahulroy commented 6 months ago

@shihabmridha for me, the downloaded files seems to be damaged. I used the PDF format.

Also, while downloading, CloudFlare threw a human verification captcha. Is there a config to slow down the downloading processes. Maybe stay on single page for 10-15 seconds?

shihabmridha commented 6 months ago

@iamrahulroy Thank you for pointing it out.

The downloaded files seems to be damaged. I used the PDF format.

It is an issue with bun. Found a solution for it. Now it should work.

CloudFlare threw a human verification captcha

I do not know how to bypass the captcha verification. What I do is, I run the script in headless = false mode so that I can see the browser and interact with it if necessary. By doing this, if there is any captcha I just resolve it manually.

Is there a config to slow down the downloading processes.

There is not a process to do it automatically. But, you can set batchSize = 1 (which is the default) so that we only download one page at a time. Then go to download.ts file and add the following code at the top of the downloadPage(...) function.

private async downloadPage(linkWithTitle: PageTitleAndLink, pageNumber: number) {
    await waitFor(3000); // in milliseconds
    const { title, link } = linkWithTitle;
    ...
}

Also notice that I have removed the config directory and using .env files instead. Read the updated documentation.