Let's look at the code for uploading subtitles and downloading videos from YouTube as an example.
1. Go to https://replit.com and register.
2. Then click Create app in the main menu
3. We choose Choose a Template
4. We find Python
5. Call and click Create App
6. You should see a window with the main.py file
7. On the same page, create the requirements.txt folder
and enter these lines there for the code to work properly:
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
Flask
requests
pydub
browser-cookie3
yt-dlp
8. Next, create the replit.nix file
and enter this code there:
{pkgs}: {
deps = [
pkgs.ffmpeg-full
pkgs.python311full
pkgs.ffmpeg
];
}
9. PNext, create the cookies.txt folder, where we will store our cookies from the browser to bypass YouTube spam protection.
To receive cookies:
10. Click Export All Cookies and copy the contents of the downloaded file to the cookies.txt folder that we created earlier on replit
11. Then we go back to main.py and paste our code
12. Run the application and wait for the next page:
13. Next, copy the link to our application and add the word /audio at the end of the url link
It should look like this: https://adf50a07-ff24-48e6-bb14-5e1d16af97b2-00-1mxttap45ya2u.riker.replit.dev/audio
It's done. Now you can send http requests to this link with n8n.
Attention! In order for your code to work continuously, even when your computer is off, you need to enter your code using the Deploy button.
This feature is only available through a paid subscription.