YtStats is a privacy-focused WebAssembly application built with Qt 6 & QML. It analyzes your personal YouTube watch history to generate detailed statistics about your viewing habits without ever sending your data to a server.
Privacy Note: This application runs entirely in your browser (Client-Side). Your Google Takeout data is processed locally on your machine and is never uploaded to any external server.
- 📈 Watch Time Analysis: Calculate exactly how much time you've spent watching videos (total and per year).
- 🏆 Top Channels: Discover which creators you watch the most.
- 🎬 Top Videos: See your most re-watched videos of all time.
- 📅 Yearly Recap: Generate a "Spotify Wrapped" style summary for your YouTube usage.
- 📂 Format Support: Supports both JSON and HTML history files from Google Takeout.
- 🚀 High Performance: Powered by C++ and WebAssembly for fast processing of large history files.
- Framework: Qt 6.8 (QML & C++)
- Platform: WebAssembly (WASM)
- Build System: CMake
- Compiler: Emscripten
To build this project, you need a Linux environment (tested on Fedora 42) with the following installed:
- System Dependencies:
cmake,ninja-build,python3 - Qt 6.8 (Target): The WebAssembly (Multithreaded) binaries.
- Qt 6.8 (Host): The Linux Desktop (
gcc_64) binaries (Required for QML compilation tools). - Emscripten SDK: Version matching your Qt release (e.g., v3.1.56 for Qt 6.8).
Ensure your Emscripten environment is active:
# Adjust path to your emsdk installation
source ~/emsdk/emsdk_env.shSince this is a cross-compiled project, you must point CMake to your Host Qt installation using QT_HOST_PATH.
git clone [https://github.com/Rob1d/YtStats](https://github.com/Rob1d/YtStats.git)
cd YtStatsmkdir build-wasm
cd build-wasm~/Qt/6.8.0/wasm_multithread/bin/qt-cmake \
-DQT_HOST_PATH=~/Qt/6.8.0/gcc_64 \
..cmake --build . 🚀 How to Run Because this project uses multithreading, browsers require specific security headers (SharedArrayBuffer support). You cannot simply open the .html file.
Local Development Server Create a file named server.py in your build directory:
from http.server import HTTPServer, SimpleHTTPRequestHandler
import sys
class SecurityHeaderHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header("Cross-Origin-Opener-Policy", "same-origin")
self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
super().end_headers()
def do_GET(self):
if self.path.endswith('.wasm'):
self.send_header("Content-Type", "application/wasm")
super().do_GET()
if __name__ == '__main__':
port = 8000
print(f"Serving at http://localhost:{port}")
HTTPServer(('localhost', port), SecurityHeaderHandler).serve_forever()Run the server:
python3 server.pyOpen your browser to http://localhost:8000/YtStats.html.
To use YtStats, you need your history file from Google:
Go to Google Takeout.
Deselect all, then find and select YouTube and YouTube Music.
Click "All YouTube data included" and select only "history".
Click "Multiple formats" and ensure History is set to JSON (preferred) or HTML.
Proceed to export and download the ZIP file.
Extract the ZIP and load watch-history.json into YtStats.
If hosting on Netlify, Vercel, or Cloudflare Pages, ensure you add the following headers to your configuration to enable multithreading:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
This project is licensed under the MIT License - see the LICENSE file for details.