Skip to main content

copyyoutube

YouTube downloader dengan arsitektur terinspirasi yt-dlp.

Arsitektur

URL → CopyYoutubeDL (orchestrator)
         ├─ InfoExtractor   → info_dict (metadata + formats)
         ├─ Format selection
         ├─ FileDownloader  → download file(s)
         └─ PostProcessor   → merge / extract audio / etc.

Komponen utama:

Modul Peran
orchestrator.py CopyYoutubeDL — koordinator pusat (seperti YoutubeDL)
extractor/youtube.py YoutubeIE — YouTube via yt-dlp
extractor/ytdlp_generic.py Fallback untuk Vimeo, Dailymotion, dll.
extractor/generic.py Direct media URL (.mp4, .webm, …)
plugins.py Plugin discovery (copyyoutube_plugins/)
utils/progress.py Progress bar terminal
downloader/ FileDownloader base + HttpFD
postprocessor/ PostProcessor base + FFmpeg merger/audio
options.py CLI argparse → params dict
globals.py Registry extractor & post-processor

Data mengalir melalui info_dict — dictionary yang diperkaya di setiap tahap pipeline.

Instalasi

pip install -e .
# atau
pip install httpx yt-dlp
PYTHONPATH=. python3 -m copyyoutube "URL"

Tests

pip install pytest
PYTHONPATH=. python3 -m pytest tests/ -v

Penggunaan

CLI

# Download video terbaik
copyyoutube "https://www.youtube.com/watch?v=VIDEO_ID"

# Download video + audio terpisah, merge otomatis (butuh ffmpeg)
copyyoutube -f bestvideo+bestaudio "https://youtu.be/VIDEO_ID"

# Extract audio saja
copyyoutube -x --audio-format mp3 "https://youtu.be/VIDEO_ID"

# Dump info JSON tanpa download
copyyoutube -j "https://youtu.be/VIDEO_ID"

# Pilih output directory
copyyoutube -P ./downloads "https://youtu.be/VIDEO_ID"

# Progress bar (aktif default, nonaktifkan dengan --no-progress)
copyyoutube --no-progress "URL"

# List extractor terdaftar
copyyoutube --list-extractors

# Site lain (Vimeo, Dailymotion, dll.) via yt-dlp fallback
copyyoutube "https://vimeo.com/VIDEO_ID"

# Direct media URL
copyyoutube "https://example.com/video.mp4"

Plugin

# Load plugin custom
copyyoutube --plugin-dirs ./examples/sample_plugin --list-extractors

# Disable plugin
copyyoutube --no-plugins "URL"

Struktur plugin:

my_plugin/
└── copyyoutube_plugins/
    ├── extractor/
    │   └── mysite.py      # class MySiteIE(InfoExtractor)
    └── postprocessor/
        └── mypp.py        # class MyCustomPP(PostProcessor)

Plugin juga bisa dipasang di ~/.config/copyyoutube/plugins/.

Library

from copyyoutube import CopyYoutubeDL

# Extract info saja
with CopyYoutubeDL({"quiet": True}) as ydl:
    info = ydl.extract_info("https://youtu.be/VIDEO_ID", download=False)
    print(info["title"], info["formats"])

# Download penuh
ydl_opts = {
    "format": "bestvideo+bestaudio",
    "output_dir": "./downloads",
    "postprocessors": [{"key": "FFmpegMerger"}],
}
with CopyYoutubeDL(ydl_opts) as ydl:
    ydl.download(["https://youtu.be/VIDEO_ID"])

Menambah Extractor Baru

from copyyoutube.extractor import register_extractor
from copyyoutube.extractor.common import InfoExtractor

@register_extractor
class MySiteIE(InfoExtractor):
    _VALID_URL = r"https?://example\.com/video/(?P<id>[0-9]+)"
    IE_NAME = "example"

    def _real_extract(self, url):
        video_id = self._match_id(url)
        return {
            "id": video_id,
            "title": "...",
            "formats": [{"url": "...", "ext": "mp4", "protocol": "https"}],
        }

Requirements

  • Python 3.10+
  • httpx — HTTP client untuk downloader
  • yt-dlp — ekstraksi metadata & format URL YouTube (PO token, decipher, dll.)
  • ffmpeg (opsional) — merge video+audio dan extract audio

Catatan: YouTube saat ini memerlukan PO token / signature decipher yang terus berubah. Extractor YouTube kita menggunakan yt-dlp sebagai backend ekstraksi, sementara pipeline download & post-process tetap diimplementasi sendiri mengikuti arsitektur yt-dlp.

Download files

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

Source Distribution

copyyoutube-0.1.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

copyyoutube-0.1.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file copyyoutube-0.1.0.tar.gz.

File metadata

  • Download URL: copyyoutube-0.1.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for copyyoutube-0.1.0.tar.gz
Algorithm Hash digest
SHA256 125bd667be82dc91cdb68553de91509b2082f51bd8a284d09f898b77e590d90b
MD5 5db7f6937c2a387158b3e50f45c4a29e
BLAKE2b-256 c4a649c892cee591b5ae9e7eabac799893cb92545356c41b76e008625d224fc2

See more details on using hashes here.

File details

Details for the file copyyoutube-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: copyyoutube-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for copyyoutube-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5ea22815f2f42e37a226b70af77ae25204c6c9a0335dc431674231cb8b5f192
MD5 0265c3b617a5f857a71859e9097abc91
BLAKE2b-256 a4d6b928b4185f3a6b79d76727c0b3c1262a63927a18e351a34a16c8bcfbce27

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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