# Ticket: Google Data Portability YouTube activity investigation

## Metadata
- Type: Ticket
- Status: Blocked
- Project: YouTube-to-Obsidian Knowledge Capture
- Created: 2026-05-15
- Updated: 2026-05-17
- Priority: High

## Goal

Investigate and prototype whether Google Data Portability can provide automated/background access to YouTube My Activity/watch-history data for the YouTube-to-Obsidian pipeline.

## Why

The system needs watched-video identity and timestamps without manual Google Takeout downloads. If Google Data Portability can access YouTube My Activity, it may be the best official route for background imports.

## Scope

Included:
- Review Google Data Portability API support for YouTube My Activity / watch history.
- Identify required OAuth scopes, consent-flow requirements, token lifetime/refresh behavior, and app verification constraints.
- Determine whether the API can run periodically in the background after user authorization.
- Determine returned data format: video URL/ID, title, timestamp, activity type, Shorts indicators if any.
- Build a minimal prototype only after confirming requirements and user approval.
- Store imported activity data in server-side staging, not Obsidian.
- Update daily staging notes with imported watched-video records if feasible.

Not included:
- Scraping Google My Activity webpages.
- Storing Google account password.
- Writing to the live Obsidian vault.
- Importing YouTube Shorts by default unless flagged/discussed.

## Acceptance Criteria

This ticket is done when:
- [x] Required Data Portability resources/scopes for YouTube My Activity are identified.
- [ ] OAuth/app setup requirements are documented. Initial notes captured in `projects/youtube-to-obsidian/google-data-portability-research.md`.
- [x] Background automation feasibility is confirmed or ruled out. Result: blocked for now because Google reports Data Portability is not available in the user's country/region.
- [ ] Security/token storage plan is documented.
- [x] A sample API response or documented expected schema is captured.
- [x] Decision is made: Data Portability is blocked/deferred; investigate fallback sources.

## Questions

- Does Google Data Portability expose YouTube watch history as part of YouTube My Activity?
- Does it include exact watch timestamps or only export generation timestamps?
- Is access one-time export style, recurring, or renewable via OAuth?
- Are refresh tokens available for this API, or must the user periodically re-authorize?
- Does the API require Google Cloud project verification for personal use?
- Can we filter/export by date range to support daily notes efficiently?
- Does the exported activity include enough data to identify Shorts and ignore them by default?

## Plan / Next Actions

- [x] Research official Google Data Portability API docs for YouTube My Activity resources.
- [x] Draft OAuth/security design for local server use.
- [ ] Identify required Google Cloud Console setup steps for the user.
- [x] Decide whether to create a minimal API client in the repo.
- [ ] If approved, prototype authorization and one small export into server-side staging. Probe script created; waiting on Google OAuth client secret.

## 2026-05-17 Spec Advancement

Confidence level: high that this route is blocked for now; medium that the research remains useful if region availability changes.

Decisions now stable:
- Google Data Portability should not be the active implementation path because Google reports it unavailable in the user's country/region.
- Existing probe/research should be retained but not allowed to block the YouTube workflow.

Refined next milestone:
- Close or archive as blocked/deferred after ensuring fallback ticket has all necessary context.

Updated next actions:
- [ ] Copy any remaining useful findings into the fallback ticket/spec.
- [ ] Stop active implementation work on Data Portability unless availability changes.

## Notes

- Manual Google Takeout is not the desired operating model; it remains only a fallback/debug path.
- Prefer official Google OAuth/API access over scraping.

## Research Notes

See `projects/youtube-to-obsidian/google-data-portability-research.md`. Initial finding: resource `myactivity.youtube` and restricted OAuth scope `https://www.googleapis.com/auth/dataportability.myactivity.youtube` appear to be the correct route. The API is archive-based and supports time-based access that may permit exports every 24 hours for 30 or 180 days, subject to OAuth/verification constraints.

## Probe Implementation

Created `scripts/google_data_portability_probe.py` and `projects/youtube-to-obsidian/google-data-portability-probe-runbook.md`. Next dependency: user-created Google Cloud OAuth client secret JSON for the Data Portability API. Secrets/tokens must not be committed.

## Blocker

The OAuth link worked, but Google reported that Data Portability is not available in the user's country/region. This blocks the route for now. Keep the probe code and research notes, but move next effort to fallback watch-history sources.

## Archive Note

Archived because the YouTube-to-Obsidian project is dead in the water for now. Retained for future reference if requirements change.
