Skip to content

Commit a5b3559

Browse files
authored
Update README.md
update the readme according to the latest release.
1 parent ce42775 commit a5b3559

File tree

1 file changed

+66
-37
lines changed

1 file changed

+66
-37
lines changed

README.md

Lines changed: 66 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
11
# Code With Mosh Downloader
22

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.com with 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.
44

55
**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.**
66

77
## Motivation for the project
88

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.
1010

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.
1212
<br>
1313
<br>
14+
1415
## Requirements
1516

16-
- Python 3
17+
- python 3
18+
- pip
19+
1720
<br>
21+
1822
## Installation
1923

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
2141

2242
This project uses poetry for dependency management, building and generating a cli command. So to install [poetry](https://python-poetry.org/). run
2343

@@ -29,7 +49,7 @@ Or go to the [docs](https://python-poetry.org/docs/) and install poetry using an
2949

3050
<br>
3151

32-
### Clone the repo
52+
#### -> Clone the repo
3353

3454
Clone the repo and move in to it
3555

@@ -39,7 +59,7 @@ git clone https://github.com/bython17/cwm-downloader && cd cwm-downloader
3959

4060
<br>
4161

42-
### Install dependencies and setup the CLI using poetry
62+
#### -> Install dependencies and setup the CLI using poetry
4363

4464
**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)
4565

@@ -66,7 +86,29 @@ Now all dependencies should be installed in a venv and you can issue the command
6686

6787
<br>
6888

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
70112

71113
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.
72114

@@ -80,13 +122,12 @@ The app relies on a json file that contains the headers and cookies of a valid a
80122
- Right click on the first request
81123
- Select the sub option "copy all as cURL" from the option copy
82124
- 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
84126

85127
```bash
86-
poetry run cwm-downloader --edit-credentials
128+
cwm-downloader --edit-credentials
87129
```
88130

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` .
90131

91132
- 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/.
92133

@@ -97,12 +138,12 @@ Now you are ready to run and use the program! 😎
97138
## Usage
98139

99140
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>
104144
**Download all lectures**
105145
<br>
146+
<br>
106147
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.
107148

108149
```
@@ -112,8 +153,10 @@ cwm-downloader download https://codewithmosh.com/courses/ultimate-c-plus-plus-pa
112153
This should download all the sections and lectures of the course. and btw you can use any lecture URL that is found on that course.
113154
<br>
114155
<br>
156+
<br>
115157
**Download only one lecture**
116158
<br>
159+
<br>
117160
To download a single lecture you can do this
118161

119162
```
@@ -123,12 +166,19 @@ cwm-downloader download https://codewithmosh.com/courses/ultimate-c-plus-plus-pa
123166
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.
124167
<br>
125168
<br>
169+
<br>
126170
**Download a course from a specific point on wards**
127171
<br>
172+
<br>
128173
To do that just specifiy the point you want to start and don't specifiy the ` --only` flag.
129174

130-
There are a few more commands to play around with just check em out using
175+
```
176+
cwm-downloader download https://codewithmosh.com/courses/ultimate-c-plus-plus-part1/lectures/42187035 --section 2 --lecture 1
177+
```
178+
<br>
179+
<br>
131180

181+
There are a few more commands to play around with just check em out using
132182
```
133183
cwm-downloader --help
134184
```
@@ -139,27 +189,6 @@ And you can also see the help message for the download subcommand
139189
cwm-downloader download --help
140190
```
141191

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
153-
154-
```
155-
pip install dist/cwm_downloader-0.1.0-py3-none-any.whl
156-
```
157-
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-
163192
## Contributions
164193

165194
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

Comments
 (0)