Skip to main content

A tool to convert YouTube videos to Markdown format.

Project description

🎬 yt2md

PyPI Python Version License

🚀 YouTube to Obsidian Markdown converter with metadata extraction and timestamped subtitles.


✨ Features

  • Smart Metadata Extraction: Title, author, views, publish date, duration, tags
  • Multi-language Subtitles: Automatic fallback (en/US → user-specified → first available)
  • Obsidian Integration: Frontmatter with video details and wiki-style links
  • Async Architecture: Parallel processing of multiple videos
  • Proxy Support: SOCKS/HTTP proxies via environment variables
  • Subtitle Processing: XML parsing with HTML entity decoding
  • Timecode Links: Clickable timestamps linking to exact video moments

📦 Installation

pipx install yt2md

🚀 Usage

Basic Conversion

yt2md VIDEO_URL or VIDEO_ID -O output.md

Multiple Videos + Russian Subtitles

yt2md ID1 ID2 ID3 -L ru -O vault/notes.md

Clipboard Integration

# Linux (Wayland)
yt2md ID | wl-copy

# Linux (X11)
yt2md ID | xclip -selection clipboard

# macOS
yt2md ID | pbcopy

# Windows
yt2md ID | idk?

🔧 Proxy Configuration

Set Environment Variables

export HTTP_PROXY="socks5://localhost:9050"
export HTTPS_PROXY="$HTTP_PROXY"

Usage with Proxy

yt2md VIDEO_ID --language en --output research.md

📝 Example Output

---
url: https://youtu.be/abc123
title: "Advanced Python Techniques"
channel: PyMaster
views: 123,456
duration: 15m 30s
published: 2024-03-15T09:30:00Z
tags: [python, programming, tutorial]
---

# Advanced Python Techniques

**Channel:** [[PyMaster]]
**Published:** `2024-03-15T09:30:00Z`
**Duration:** 15m 30s
**Views:** 123,456

## Description
Explore advanced Python features...

## Subtitles
[00:01:23] Welcome to the tutorial
[00:05:45] Context managers deep dive
[00:10:12] Metaclass examples

⚙️ Technical Details

Metadata Extraction

  • Parses ytInitialPlayerResponse JSON blob
  • Handles ISO 8601 dates and view count formatting
  • Fallback values for missing fields

Subtitle System

  1. Language priority: specified → lang-US → en → en-US → first available
  2. XML parsing with error handling
  3. Automatic text cleaning (HTML entities, newlines)

Performance

  • Async HTTP client with 3 retry attempts
  • Parallel video processing
  • Lightweight XML parser (lxml)

📄 License

MIT License. See LICENSE for details.


👤 Author: Michael (@xpos587)
📧 Contact: x30827pos@gmail.com 🐛 Issues: https://github.com/xpos587/yt2md/issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt2md-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt2md-1.0.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file yt2md-1.0.0.tar.gz.

File metadata

  • Download URL: yt2md-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for yt2md-1.0.0.tar.gz
Algorithm Hash digest
SHA256 efecdb735ef903dde57b768286419ca1a7a42d5aa9f0fe339e8af8771a95545b
MD5 88daedea4d330598da8cebb481c80224
BLAKE2b-256 9fa444752e3e8f9dd19347a6f33920c4b0471e607e0bdc3c948974276e375c7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt2md-1.0.0.tar.gz:

Publisher: release.yaml on Xpos587/yt2md

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yt2md-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: yt2md-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for yt2md-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cc58200986a65e993fde00d1a59a465a81b053bc37a983f86c702cd07c55709
MD5 86b70261c67f1bf14e010cd9d9ddf5db
BLAKE2b-256 784276a15bb0621533a2dc7b9301a0f2ced5b71ef52b67bcd71903bff13ba9e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt2md-1.0.0-py3-none-any.whl:

Publisher: release.yaml on Xpos587/yt2md

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page