LocalTube is a lightweight, local front-end for YouTube that lets you search and watch videos without the tracking and analytics of the official YouTube site. It leverages the YouTube Data API v3 to fetch video data and stream content directly from YouTube, offering a cleaner, more private viewing experience.
This project is designed for personal use and runs on your local machine. Optionally, you can host it on a remote VPS for broader access.
- Privacy-focused: No Google Analytics or user tracking.
- Simple interface: Search and play videos with ease.
- Local setup: Runs locally using a basic Python web server.
Follow these steps to set up LocalTube on your machine:
- Purpose: The API key enables access to YouTube's video data.
- Steps:
- Sign in to the Google Cloud Console with a Gmail account.
- Create a new project (or use an existing one).
- Enable the YouTube Data API v3 for your project.
- Go to the "Credentials" section and generate an API key.
- Note: Keep your API key confidential and avoid sharing it publicly.
-
Clone the LocalTube repository:
git clone https://github.com/EdgeOfAssembly/LocalTube.git
-
Navigate to the project directory:
cd LocalTube -
Start a simple web server with Python:
python3 -m http.server 8000
-
Open your browser and visit
http://localhost:8000. -
Give your YouTube API key when asked and from Settings on the left click it open, make sure the API key is there ans then click Save Settings.
Note: For more detailed instructions, including step-by-step guidance and screenshots, check out the LocalTube_Tutorial.pdf included in this repository.
If you’d like to download videos (e.g., in 1080p or higher) through LocalTube instead of just streaming, you’ll need to set up a Python virtual environment and install additional packages (flask and yt-dlp). This is optional and only necessary if your Linux package manager doesn’t provide these libraries or if you want to enable downloading functionality.
- Python 3.x installed on your system (check with
python3 --version). - pip (Python package installer, usually included with Python).
-
Create a Python Virtual Environment
This isolates the project’s dependencies from your system Python. In theLocalTubedirectory, run:python3 -m venv venv
-
Activate the Virtual Environment Activate it to use the isolated Python environment:
source venv/bin/activate- Your terminal prompt should change (e.g., (venv) appears), indicating the environment is active.
-
Install Required Packages Use the provided requirements.txt file to install flask and yt-dlp:
pip install -r requirements.txt
- This installs flask (for the web server) and yt-dlp (for downloading videos).
-
Run the Flask Application Start the Flask server to enable downloading (replace app.py with your actual Flask script name if different):
python3 app.py
- The server typically runs on http://localhost:8000. Check your script’s output for the exact address.
-
Access LocalTube with Downloading Open your browser and go to http://localhost:8000 (or the address provided by the Flask server). You can now use LocalTube’s downloading feature.
- Deactivating the Environment: When done, deactivate the virtual environment with:
deactivate- requirements.txt: Ensure this file is in your LocalTube directory with the content:
flask
yt-dlp- Why This Is Optional: The basic streaming setup (using python -m http.server 8000) doesn’t require this. Only set this up if you want to download videos.
- Search: Enter a query (e.g., "predator") in the search bar at the top.
- View Results: Click "Search" to display video thumbnails below the player.
- Play Videos: Click a thumbnail to load and play the video in the embedded player.
Tip: Use the "Go to Results" link in the sidebar to jump to the search results section.
- API Quota: The free API key provides around 100 requests per day, suitable for personal use.
- Streaming: Videos are streamed from YouTube, requiring an internet connection.
This project is in the public domain. Feel free to use, modify, and distribute it without any restrictions.
- No Search Results: Verify your API key is correctly inserted in
index.html. - Server Issues: Ensure the Python web server is running and
http://localhost:8000is accessible. - Quota Limits: If you exceed the API request limit, request a quota increase from Google or switch to a new API key.
For support, feedback, or contributions, feel free to:
- Open an issue on the GitHub Issues page.
- Email me directly at [email protected]
Enjoy a tracker-free YouTube experience with LocalTube!