← All journal articles

The first useful program in 15 minutes

The first useful program

The first project will be useful but very simple. We will make a program that will save YouTube audio and video to a local drive.

I spend a lot of time learning new things. I often watch videos about how to train, or how to write articles and blog, etc. YouTube has a lot of videos on these topics. There are really valuable ones that you would like to have with you when you don't have an Internet connection, for example, on a plane or at the cottage.

If this is your first programming experience, you'll be surprised how easy the project will be. And so as not to disappoint you, the next step is to do something more complicated: a program that will translate YouTube audio into text.

We will write code in python. This language is one of the easiest languages to learn. However, very serious projects are written on it, from websites to games, from simple computational tasks to artificial intelligence developments.

We'll need a few things to get started:

  1. An integrated development environment - IDE. PyCharm is best for python. You can download it from here https://www.jetbrains.com/ru-ru/pycharm/ 
  2. Access to a large language model. The techies call it LLM, we'll call it as well. It's best to use ChatGPT4 or equivalent. Claude, Lama3 will do. There are a few other good ones, but that's a topic for another conversation. If you don't have anything else at hand yet, try this one, it's very good: https://www.phind.com/. It works without a VPN.
  3. Many LLMs don't work in Russia, so you'll need a VPN to work with the most modern ones.

3 minutes before the first useful result

The question we ask LLM is cleverly called “prompt”.

The general rules for working with an LLM are: ask her questions the way you would ask them to a very intelligent and endlessly patient person. Don't be afraid to ask. If something is not clear, ask again, clarify terms and concepts if necessary.

It is better to start with the most abstract questions, very often you will receive a high-quality answer right away. If you don't understand the answer, try reformulating the question. If it doesn't work out in three or four attempts, start digging into the details.

I usually work with several chat rooms: in one I get answers to the main topic, in others I clarify the meaning of words and concepts, and also solve various abstract questions.

We will download this link

https://www.youtube.com/watch?v=TwDJhUJL-5o

Launching PyCharm

At the bottom of the screen, you can see the result of running the program, she wrote Hi PyCharm. You can play around with outputting different words. The more you play with tools, the quicker and easier it will be to disassemble. So enjoy having a computer do what you want it to do

Clear the development environment screen

To clear the screen, press Ctrl-a (CMD-a) and delete all content.

First prompt - please write the code

write a python program that will download YouTube videos

напиши программу на питоне, которая будет скачивать видео с ютюба

This is not the best offer, now we'll see why

The result of the prompt - LLM says that you need to install the pytube module. That's ok, let's hand it over. You need to open a terminal in the IDE, copy the command and paste it into the terminal. As a result, we now have the required library installed.

https://www.dropbox.com/scl/fi/bbcu973bvscrxchhwwlln/.mov?rlkey=2tyznc16jfwyljzuujiwvcsr3&dl=0

But if we try to run the code, we won't succeed. And that's ok, we'll figure out how to fix it.

Run code

Running the code results in an error

https://www.dropbox.com/scl/fi/l7eavqvvcqbdg1t1yrz0j/.mov?rlkey=f4dyqzb1fgtvy0sp8hx0znlb7&dl=0

As you can see from the example, the error screen can look daunting. Try clicking on the links to see what opens. Just don't change the code in the broken files, it will be difficult to fix it later.

When you've played enough, close all tabs and return to the main screen, as shown in the video.

Code repair

Just copy the entire error message and send it to LLM. Read the answer carefully. We see that the IDE primarily swears at the URL format. And he's right - we don't have a URL there, but a stub. Paste our URL

 
https://www.youtube.com/watch?v=TwDJhUJL-5o
 

and restart.

https://www.dropbox.com/scl/fi/8ai5nb04l5hzokbw0f3j4/.mov?rlkey=7oz71x12xtcuumyxxynnjzut8&dl=0

It takes a few seconds to download, so you have to wait.

Result

The result was a bit of a curve - the video was saved to a folder called “paste the save path here”. We'll fix it next time.

It is also not clear what the program does while the download is in progress. It will be necessary to bring beauty. We'll do that next time too.

We haven't written a single line of code, but we have a working program that does what we wanted it to do — download videos.

You can go get some air or eat something healthy.

Until we meet again!

Bonus track: trying out the free Phind

https://www.dropbox.com/scl/fi/hle7p8nxl3ps7vsu3wwmn/phind.mov?rlkey=2yo1gzmipg2rnorj2sppf3d1k&dl=0

Let's go to the site https://www.phind.com/

Select the Chat section at the top

Writing a prompt

 
напиши код на питоне, который будет скачивать видео с ютюб.
Вот ссылка которую нужно скачать, но хочетя, чтобы он скачивал любую ссылку, которую я дамhttps://www.youtube.com/watch?v=TwDJhUJL-50‍
 

Create a new file in the IDE

Copy and paste the code into the IDE.

Let's launch it differently!

If we just click on the green button, we'll run the old script. In this case, we right click on the tab with the code we want to run and select run

That's all for now, bye bye!

You can also read

Courses for kids

Progkids обратная связь

It's easy to sign up for a free class

Already in the first lesson, we'll dive into the basics of development and create a small project that your child will want to brag about.

Submit a request

ok image
Ваша заявка отправлена. Скоро мы свяжемся с Вами
Ошибка при отправке формы