You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-37Lines changed: 66 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,43 @@
1
1
# Code With Mosh Downloader
2
2
3
-
This is a python CLI program made for downloading enrolled courses and lectures from https://codewithmosh.com including all exercises and pdfs needed. This program allows you to download full courses, sections and lectures with ease. This program requires a valid credentials(headers and cookies) of an enrolled user to work.
3
+
This is a python CLI program made for downloading enrolled courses and lectures from https://codewithmosh.comwith high quality including all exercises and pdfs needed. This program allows you to download full courses, sections and lectures with ease. This program requires a valid credentials(headers and cookies) of an enrolled user to work.
4
4
5
5
**Note:****This project is only valid for people who have a valid account Or if the courses are free and are not locked. The project has no malicious intents what so ever.**
6
6
7
7
## Motivation for the project
8
8
9
-
For along time I watched Mosh's youtube channel where he only shows a tiny part of the full course. This made me eager to buy his courses and I ended up subscribing to the monthly subscription plan. But then I wanted to download alot of courses from the site so using my python skills I made [cwm-downloader-old](https://github.com/bython17/cwm-downloader-old) but that didn't seem clean and was kinda bulky. So I rewrote it again and here it is.
9
+
For a long time I watched Mosh's YouTube channel where he only shows a tiny part of the full course. This made me eager to buy his courses and I ended up subscribing to the monthly subscription plan. But then I wanted to download a lot of courses from the site so using my python skills I made [cwm-downloader-old](https://github.com/bython17/cwm-downloader-old) but that didn't seem clean and was kinda bulky. So, I rewrote it again and here it is.
10
10
11
-
**Note** Currently my subscription has ended and I can't test the app properly anymore. So I would appreciate contributions alot. Read more about contribution's at the bottom.
11
+
**Note** Currently my subscription has ended and I can't test the app with all the courses available anymore. So, I would appreciate contributions a lot. Read more about contributions at the bottom.
12
12
<br>
13
13
<br>
14
+
14
15
## Requirements
15
16
16
-
- Python 3
17
+
- python 3
18
+
- pip
19
+
17
20
<br>
21
+
18
22
## Installation
19
23
20
-
### Install poetry
24
+
### Using pre-built `.whl` files
25
+
#### -> Download the python wheel file
26
+
Head over to the [releases](https://github.com/bython17/cwm-downloader/releases/latest) page and download the python wheel or the `.whl` file.
27
+
#### -> Install the program using pip
28
+
First navigate to the directory where you downloaded the wheel file and execute the following command.
29
+
```bash
30
+
pip install [whl-file]
31
+
```
32
+
_Replace the `whl-file` with the python wheel file you downloaded_
33
+
34
+
Even though it isn't recommended, you can use the sdist(`.tar.gz`) file to install the project.
35
+
36
+
And there you go, the program is installed. Go to the [Edit credentials section](#edit-the-credentialsjson-file) to authenticate yourself and download the courses you paid for. <br>
37
+
If for any reason the pre-built binary doesn't work or has an error when installing with pip, check out the [Manual installation](#manual-build-installation), may be that could help.
38
+
39
+
### Manual build installation
40
+
#### -> Install poetry
21
41
22
42
This project uses poetry for dependency management, building and generating a cli command. So to install [poetry](https://python-poetry.org/). run
23
43
@@ -29,7 +49,7 @@ Or go to the [docs](https://python-poetry.org/docs/) and install poetry using an
29
49
30
50
<br>
31
51
32
-
### Clone the repo
52
+
#### -> Clone the repo
33
53
34
54
Clone the repo and move in to it
35
55
@@ -39,7 +59,7 @@ git clone https://github.com/bython17/cwm-downloader && cd cwm-downloader
39
59
40
60
<br>
41
61
42
-
### Install dependencies and setup the CLI using poetry
62
+
#### -> Install dependencies and setup the CLI using poetry
43
63
44
64
**NOTICE**: If you are a windows user, you need to enable the [Windows Long Path](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershel) in order to install the dependencies. To enable [Windows Long Path](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershel) you can execute the following PowerShell script(Windows 10, Version 1607, and Later)
45
65
@@ -66,7 +86,29 @@ Now all dependencies should be installed in a venv and you can issue the command
66
86
67
87
<br>
68
88
69
-
### Edit the credentials.json file
89
+
#### -> Building and installing the project using `pip` and `poetry build`
90
+
To build and install the project follow the steps below, but before doing anything, you need to have python in path. If you don't have python in path, then [Check this out](https://medium.com/edureka/add-python-to-path-f97fcab2a58d).
91
+
92
+
93
+
Navigate to the projects root directory for the last time and run
94
+
95
+
```
96
+
poetry build
97
+
```
98
+
99
+
Poetry will now generate a dist directory which contains a wheel file that is installable by pip so run
100
+
101
+
```
102
+
pip install dist/[.whl file]
103
+
```
104
+
_Replace the `[.whl file]` with the `.whl` file that poetry has created for you in the dist directory from the project's root. Or you can install the ```.tar.gz``` file that is in the same directory._
105
+
106
+
**Note** Make sure that you run this outside a child shell or while not in a venv just to be safe.
107
+
108
+
and **Horay 😃** Now you can access the command from any where in your computer !
109
+
110
+
111
+
## Edit the credentials.json file
70
112
71
113
The app relies on a json file that contains the headers and cookies of a valid account that is enrolled in some sort of course or lecture. To get the valid cookies and headers follow these simple steps.
72
114
@@ -80,13 +122,12 @@ The app relies on a json file that contains the headers and cookies of a valid a
80
122
- Right click on the first request
81
123
- Select the sub option "copy all as cURL" from the option copy
82
124
- Go to https://www.scrapingbee.com/curl-converter/json/ and paste the cURL you copied on the space provided and copy the final json output to your clipboard.
83
-
-Assuming you run `poetry install` , let's edit the credentials.json file to do that run the following command inside the root dir of the project
125
+
-Run the program with the `--edit-credentials` option
84
126
85
127
```bash
86
-
poetry run cwm-downloader --edit-credentials
128
+
cwm-downloader --edit-credentials
87
129
```
88
130
89
-
**_Note_** We did the the `poetry run` because we need to use the venv's python and bin not the globals. If you want you can also spawn a child shell using `poetry shell` and then run `cwm-downloader` .
90
131
91
132
- When the editor opens with the credentials.json file, delete all the contents inside and paste the contents you copied from https://www.scrapingbee.com/curl-converter/json/.
92
133
@@ -97,12 +138,12 @@ Now you are ready to run and use the program! 😎
97
138
## Usage
98
139
99
140
The app is a CLI, so you can use the `--help` option to learn more about the commands. But here are the basics
100
-
101
-
**Tip** to use the ` cwm-downloader` command like the below: First run `poetry shell` which creates a child shell or skip around to the bottom to make the command global. If you don't mind typing a longer command then you can use ` poetry run cwm-downloader` to run the command from the project root.
102
-
103
-
141
+
<br>
142
+
<br>
143
+
<br>
104
144
**Download all lectures**
105
145
<br>
146
+
<br>
106
147
To do that just execute the command with the download sub command and give it the url. For example let's download part one of the brand new C++ course.
This will tell the downloader you want to download that specifiec lecture only and nothin after that. notice here we specified a section because we need sections to get the correct lecture. if no section is given it is going to default to the first one.
124
167
<br>
125
168
<br>
169
+
<br>
126
170
**Download a course from a specific point on wards**
127
171
<br>
172
+
<br>
128
173
To do that just specifiy the point you want to start and don't specifiy the ` --only` flag.
129
174
130
-
There are a few more commands to play around with just check em out using
There are a few more commands to play around with just check em out using
132
182
```
133
183
cwm-downloader --help
134
184
```
@@ -139,27 +189,6 @@ And you can also see the help message for the download subcommand
139
189
cwm-downloader download --help
140
190
```
141
191
142
-
## Making the command global
143
-
144
-
If you are tired of going to the project directory every time and download the courses (you should be unless you are a psycho) then you can make it global by installing it using pip.
145
-
146
-
Navigate to the projects root directory for the last time and run
147
-
148
-
```
149
-
poetry build
150
-
```
151
-
152
-
Poetry will now generate a dist directory which contains a wheel file that is installable by pip so run
Or you can install the ```tar.gz``` file that is in the same directory.
158
-
159
-
**Note** Make sure that you run this outside a child shell or while not in a venv just to be safe.
160
-
161
-
and **Horay 😃** Now you can access the command from any where in your computer !
162
-
163
192
## Contributions
164
193
165
194
I have tried to document my code very well to make it easy to understand. I am not a pro python engineer by any means just a high school kid who loves to code. So I would greatly appreciate any comments and code reviews from the community and If you have a great feature in mind don't forget to hit that pull request 😁. Thanks
0 commit comments