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 130 forks source link

Support Downloading Course with all the Languages Available #9

Closed devKshitijJain closed 4 years ago

devKshitijJain commented 4 years ago

Idea is to have firstPageWithCode where user can define where the code is and then navigate to that page. Look for code block determine languages available. Store those in array. For Loop on that array and first. navigate to above page, click on the first language tab by name of language as there is inconsistency in tab index and then continue with downloading pages, and so on. Also need to match code url with course url in case user forget to change it. Although this will only work if single course is present in config file. Do you have any idea?

devKshitijJain commented 4 years ago

@shihabmridha any idea on this?

shihabmridha commented 4 years ago

@devKshitijJain, can you please share a course link with multiple available language?

devKshitijJain commented 4 years ago

https://bit.ly/2wVoLYE @shihabmridha here you go

devKshitijJain commented 4 years ago

There is a pattern for this. Basically whenever we encounter any div class = code-container, we just need to get the div before that and check if it has ul element. Class name of ul is styles__TabNav-sc-67hrh1-15 iiJTwo nav nav-tabs. I am not sure how can this dynamically works. I can take nav-tabs as text to search for in class names but I am not sure about it. So instead I will look for code-container and take index of div which is -1 of code-container and then iterate through it. How does it sound?

devKshitijJain commented 4 years ago

@shihabmridha Also I was thinking instead of asking user to enter url in config file we can ask user in terminal :-

1.) Explain why we need the url from user and ask for it. 2.) User enters the url, match it with course url. If both are from same course, continue otherwise throw error.

thomasgeoff commented 4 years ago

@devKshitijJain @shihabmridha Today I tried with my Mac, it worked perfectly for both pdf and HTML format with loginCheck: true constraint. The only suggestion I have is the same, a way to change the programming language of the code editor. I'm only able to get the codes in Java for courses which have solutions in multiple languages (eg: in Grokking the coding interview patterns there are solutions in java, python, c++ etc).

Thanks a lot, guys! 🥇 👍

devKshitijJain commented 4 years ago

@thomasgeoff we are already discussing this feature and I have prominent solution for this. But I don't really work on Typescript so need some help from @shihabmridha. So once enabled you will be able to get all the language code available in that course.

thomasgeoff commented 4 years ago

@devKshitijJain Good luck with that. I mostly code in Python, so I won't be able to give any inputs.

shihabmridha commented 4 years ago

@devKshitijJain I believe we can target using this nav nav-tabs > span identifier. Then we can iterate over the elements and download the page.

image

shihabmridha commented 4 years ago

Fixes https://github.com/shihabmridha/educative.io-downloader/pull/17