# YouTube Takeout stats

Parse Google/YouTube Takeout watch-history JSON or HTML into top channels, repeated videos, monthly trends, weekdays, hours, streaks, CSV, and JSON.

## Run it

- **CLI:** `gizza tool youtube-takeout-stats '[{"header":"YouTube","title":"Watched Never Gonna Give You Up","titleUrl":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","subtitles":[{"name":"Rick Astley"}],"time":"2024-01-01T18:10:00Z"}]'`
- **Web:** https://gizza.ai/tools/youtube-takeout-stats/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/youtube-takeout-stats/tool.json

## Inputs

- `input` — YouTube Takeout watch history _(field)_
- `output` — Output format _(field)_
- `report` — Report section _(field)_
- `top` — Top rows _(field)_
- `utc_offset` — UTC offset for JSON timestamps _(field)_
- `include_ads` — Include ad impressions _(field)_
- `include_music` — Include YouTube Music rows _(field)_
- `start_date` — Start date (optional) _(field)_
- `end_date` — End date (optional) _(field)_

## Output

- Watch history stats (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `input` — YouTube Takeout watch history
- `output` — Output format
- `report` — Report section
- `top` — Top rows
- `utc_offset` — UTC offset for JSON timestamps
- `include_ads` — Include ad impressions
- `include_music` — Include YouTube Music rows
- `start_date` — Start date (optional)
- `end_date` — End date (optional)

Example: `https://gizza.ai/tools/youtube-takeout-stats/?input=%5B%7B%22header%22%3A%22YouTube%22%2C%22title%22%3A%22Watched%20Never%20Gonna%20Give%20You%20Up%22%2C%22titleUrl%22%3A%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ%22%2C%22subtitles%22%3A%5B%7B%22name%22%3A%22Rick%20Astley%22%7D%5D%2C%22time%22%3A%222024-01-01T18%3A10%3A00Z%22%7D%5D&output=text&report=overview&top=10&utc_offset=0&include_ads=true&include_music=true&start_date=2024-01-01&end_date=2024-12-31`

---

## About this tool

YouTube Takeout Stats turns a Google/YouTube Takeout watch-history export into a local, copy-pasteable viewing report. Paste either `watch-history.json` or `watch-history.html` and it summarizes total watches, unique videos, unique channels, top channels, repeated videos, monthly trends, weekday patterns, hourly patterns, busiest day, and longest active streak.

The default output is a text dashboard. Switch to CSV for a single table such as top channels or videos per month, or JSON when you want structured data for another script. JSON exports use UTC timestamps, so set the UTC offset to your local time before bucketing by day and hour; HTML exports already contain local wall-clock timestamps and do not need the offset.

### Worked example

Paste this minimal Takeout-style JSON and run the default dashboard:

```json
[{"header":"YouTube","title":"Watched Never Gonna Give You Up","titleUrl":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","subtitles":[{"name":"Rick Astley"}],"time":"2024-01-01T18:10:00Z"},{"header":"YouTube","title":"Watched Never Gonna Give You Up","titleUrl":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","subtitles":[{"name":"Rick Astley"}],"time":"2024-01-02T19:00:00Z"},{"header":"YouTube","title":"Watched Rust in 100 Seconds","titleUrl":"https://www.youtube.com/watch?v=5C_HPTJg5ek","subtitles":[{"name":"Fireship"}],"time":"2024-01-03T09:05:00Z"}]
```

The result starts with `YouTube watch history — 3 videos watched`, then lists the range, averages, unique video/channel counts, peak hour, longest streak, top channels, top videos, and month/weekday/hour tables.

### Limits and edge cases

- Input stays local in the browser. The WebAssembly code parses the pasted text without logging in, uploading the file, or calling the YouTube API.
- The tool accepts up to 24 MB of pasted text and up to 500,000 parsed watch records.
- If your Takeout came as a ZIP archive, unzip it first and paste the `watch-history.json` or `watch-history.html` file.
- The Takeout watch-history export does not include reliable video durations or categories. Those require authenticated YouTube Data API lookups, so this tool reports counts and timing patterns only.
- Ads and YouTube Music rows are excluded by default because they often distort regular viewing stats. Turn on the checkboxes when you want those rows included.
- Removed or private videos are counted, but they may not have a channel name in the export.

## FAQ

<details>
<summary>Does this upload my YouTube history anywhere?</summary>

No. The parser runs in WebAssembly inside your browser and the CLI runs locally. The tool does not call YouTube, does not require an account, and does not upload the pasted export.

</details>

<details>
<summary>Which Takeout file should I paste?</summary>

Use `YouTube and YouTube Music/history/watch-history.json` when you exported Takeout as JSON. If your export is HTML, paste the contents of `watch-history.html`; this tool supports both shapes.

</details>

<details>
<summary>Why are watch minutes and video categories missing?</summary>

Google Takeout watch history records the activity item and timestamp, but it does not include the duration watched or the category for each video. Getting those fields would require live YouTube API requests and an API key, which is outside this offline tool's model.

</details>

<details>
<summary>How should I use the UTC offset field?</summary>

For JSON exports, timestamps are UTC. Set the offset to your local time zone, for example `-5` for UTC-5 or `5.5` for UTC+5:30, so days and peak hours match your local viewing time. HTML exports already contain local text timestamps, so the offset is ignored for them.

</details>

## Related tools

- [Identify a data sample's format, delimiter and columns](https://gizza.ai/tools/data-format-sniffer/): Paste a data sample and find out what it is: CSV, TSV, JSON, JSON Lines, XML, HTML, fixed-width or binary, plus delimiter, quote char, encoding and column types.
- [Format and filter structured JSON logs](https://gizza.ai/tools/json-log-formatter/): Pretty-print JSON log lines, flatten nested fields, filter by level or field, and export readable logs as text, table, JSON, or CSV.
- [Query Result Formatter](https://gizza.ai/tools/query-result-formatter/): Turn raw query result rows — a JSON array, CSV, or TSV — into a clean, aligned Markdown or ASCII table for docs and chat.
- [Task Format Converter](https://gizza.ai/tools/task-format-converter/): Convert task lists between todo.txt, Markdown checklists, JSON, and CSV while preserving priorities, tags, and dates.
- [Time series generator](https://gizza.ai/tools/time-series-generator/): Generate deterministic synthetic time-series CSV, TSV, JSON or NDJSON with configurable trend, seasonality, noise, missing values and outliers.
