Has anyone found a simple/simplified way to get a YouTube history into Obsidian?
I like to copy mine over each month so I have a record of what I’ve been watching/learning, but it takes a bunch of steps. I haven’t been able to find a “clean” way to copy the list, so I have to do a lot of cleaning up after pasting it into Obsidian.
It might be a long shot, but I thought maybe someone had already figured out a better way.
1 Like
If you’re looking for a bulk solution, I don’t think Google provides access to the watch history via API and I can’t find a helpful extension or add-on in Chrome nor Firefox. The closest service that Google provides is https://takeout.google.com/ through which you can export your watch history as an HTML file (then you just have to parse it yourself, a script, or maybe an LLM).
If you’re willing to build a workflow around it, the ReadItLater plug-in could be used to capture video details automatically, then you could use that for tracking what you want to watch and whether you’ve watched it.
2 Likes
You could try asking on the web clipper channel on Discord as well.
1 Like
Zsolt has a solution for extracting data from a Youtube Channel, might work for history.
Zsolts YouTube Channel AI Summarizer
Alternately a Python Script maybe?
-
First, export your YouTube history:
- Go to Google Takeout (https://takeout.google.com)
- Select only YouTube data
- Choose “watch history” in the YouTube data options
- Download the export and extract the JSON file
-
Run the script:
- Save the script as
youtube_to_obsidian.py
- Put your YouTube history JSON file in the same folder
- Run the script with Python
The script will:
- Create an individual markdown note for each watched video
- Include YAML frontmatter with metadata
- Create a structured template for taking notes
- Add relevant tags
- Use a consistent naming format:
[date] - [video title].md
Each note will have sections for:
- Metadata (title, channel, watch date, URL)
- Your notes
- Key points
- Related videos
import json
from datetime import datetime
import os
def convert_youtube_history_to_obsidian(history_file_path, output_folder):
"""
Converts YouTube watch history JSON to Obsidian markdown files.
Each video gets its own note with metadata and tags.
Args:
history_file_path (str): Path to YouTube takeout JSON file
output_folder (str): Directory where markdown files will be created
"""
# Create output folder if it doesn't exist
if not os.path.exists(output_folder):
os.makedirs(output_folder)
# Read the JSON file
with open(history_file_path, 'r', encoding='utf-8') as f:
history = json.load(f)
for entry in history:
try:
# Extract basic info
title = entry.get('title', 'Untitled Video')
channel = entry.get('subtitles', [{}])[0].get('name', 'Unknown Channel')
timestamp = entry.get('time', '')
url = entry.get('titleUrl', '')
# Convert timestamp to datetime
watch_date = datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')
formatted_date = watch_date.strftime('%Y-%m-%d')
# Create safe filename
safe_title = "".join(x for x in title if x.isalnum() or x in (' ', '-', '_')).rstrip()
filename = f"{formatted_date} - {safe_title[:100]}.md"
filepath = os.path.join(output_folder, filename)
# Create markdown content
markdown_content = f"""---
title: "{title}"
channel: "{channel}"
watch_date: {formatted_date}
url: {url}
type: youtube-video
tags: [youtube, video-notes]
---
# {title}
## Metadata
- **Channel:** {channel}
- **Watch Date:** {formatted_date}
- **URL:** {url}
## Notes
<!-- Add your notes about the video here -->
## Key Points
<!-- List key points from the video -->
## Related Videos
<!-- Link to related videos or notes -->
"""
# Write to file
with open(filepath, 'w', encoding='utf-8') as f:
f.write(markdown_content)
print(f"Created note for: {title}")
except Exception as e:
print(f"Error processing entry: {e}")
print("\nConversion complete! Your YouTube history has been exported to Obsidian-compatible markdown files.")
# Example usage
if __name__ == "__main__":
history_file = "watch-history.json" # Your YouTube takeout JSON file
output_dir = "Youtube Notes" # Where to save the markdown files
convert_youtube_history_to_obsidian(history_file, output_dir)
1 Like