Welcome to the Youtube Facebook Downloader project! This project allows you to download videos from YouTube and Facebook using a simple web interface. The backend is built with Flask, and the frontend is built with Next.js 13.
The Youtube Facebook Downloader project is designed to provide an easy-to-use interface for downloading videos from YouTube and Facebook. The backend handles the video extraction and downloading, while the frontend provides a user-friendly interface for interacting with the backend.
To set up the backend, follow these steps:
-
Clone the repository:
git clone https://github.com/leviethung2103/youtube-facebook-downloader cd youtube-facebook-downloader/backend
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the Flask server in the background using
screen
:screen -S flask_app cd youtube-facebook-downloader/backend source venv/bin/activate python app.py # or gunicorn --bind 0.0.0.0:3001 app:app
To detach from the screen session, press
Ctrl + A
, thenD
.To reattach to the screen session later, use the following command:
screen -r flask_app
The backend server should now be running on http://localhost:3001
.
To set up the frontend, follow these steps:
-
Navigate to the frontend directory:
cd youtube-facebook-downloader/frontend
-
Install the required dependencies:
npm install
-
Create a
.env
file in the root of yourfrontend
directory and add the following:NEXT_PUBLIC_BACKEND_URL=http://localhost:3001
-
Run the development server:
npm run dev
The frontend should now be running on http://localhost:3000
.
To deploy the Flask backend using screen
, follow these steps:
-
Start a new screen session:
screen -S flask_app
-
Navigate to the backend directory and activate the virtual environment:
cd youtube-facebook-downloader/backend source venv/bin/activate
-
Run the Flask server:
python app.py # or gunicorn --bind 0.0.0.0:3001 app:app
-
Detach from the screen session: Press
Ctrl + A
, thenD
. -
To reattach to the screen session later:
screen -r flask_app
To deploy the Next.js frontend using pm2
, follow these steps:
-
Navigate to the frontend directory:
cd youtube-facebook-downloader/frontend
-
Install the required dependencies:
npm install
-
Create a
ecosystem.config.js
file in the root of yourfrontend
directory and add the following:module.exports = { apps: [ { name: "nextjs-app", script: "npm", args: "start", env: { NODE_ENV: "production", NEXT_PUBLIC_BACKEND_URL: "http://localhost:3001" } } ] };
-
Build the Next.js app:
npm run build
-
Start the Next.js app using
pm2
:pm2 start ecosystem.config.js
- Ensure that both the backend and frontend servers are running simultaneously for the application to function correctly.
- The backend server handles video extraction and downloading, while the frontend server provides the user interface.
- You can customize the project further by modifying the backend and frontend code as needed.
Screenshots of the application can be found in the screenshots
directory.
Screenshot 1: Video download page
Screenshot 2: Home page of the application
To list all active screen sessions:
screen -ls
To terminate all screen sessions:
screen -ls | grep -o '[0-9]*\.' | xargs -I {} screen -S {} -X quit
Alternatively, you can use pkill
to kill all screen sessions:
pkill screen
To check if the Flask app is running on port 3001
, you can use one of the following methods:
lsof -i :3001
netstat -tuln | grep :3001
ss -tuln | grep :3001
curl http://localhost:3001
For more information on how to use the project, refer to the documentation provided in the respective backend and frontend directories.
Happy downloading!