Skip to main content

No project description provided

Project description

kabigon

A URL content loader library that extracts content from various sources (YouTube, Instagram Reels, Twitter/X, Reddit, PDFs, web pages) and converts them to text/markdown format.

Installation

pip install kabigon
playwright install chromium

Usage

CLI

kabigon <url>

# Examples
kabigon https://www.youtube.com/watch?v=dQw4w9WgXcQ
kabigon https://x.com/elonmusk/status/123456789
kabigon https://truthsocial.com/@realDonaldTrump/posts/123456
kabigon https://reddit.com/r/python/comments/xyz/...
kabigon https://example.com/document.pdf

Python API - Sync

import kabigon

url = "https://www.google.com.tw"

# Simple usage
content = kabigon.PlaywrightLoader().load_sync(url)
print(content)

# With multiple loaders (tries each in order)
loader = kabigon.Compose([
    kabigon.TwitterLoader(),
    kabigon.TruthSocialLoader(),
    kabigon.YoutubeLoader(),
    kabigon.RedditLoader(),
    kabigon.PDFLoader(),
    kabigon.PlaywrightLoader(),  # Fallback for generic URLs
])
content = loader.load_sync(url)
print(content)

Python API - Async

import asyncio
import kabigon

async def main():
    url = "https://www.google.com.tw"

    # Single URL
    loader = kabigon.PlaywrightLoader()
    content = await loader.load(url)
    print(content)

    # Batch processing multiple URLs in parallel
    urls = [
        "https://x.com/user1/status/123",
        "https://truthsocial.com/@user/posts/456",
        "https://youtube.com/watch?v=abc",
        "https://reddit.com/r/python/comments/xyz",
    ]

    loader = kabigon.Compose([
        kabigon.TwitterLoader(),
        kabigon.TruthSocialLoader(),
        kabigon.YoutubeLoader(),
        kabigon.RedditLoader(),
        kabigon.PlaywrightLoader(),
    ])

    # Parallel processing
    results = await asyncio.gather(*[loader.load(url) for url in urls])
    for url, content in zip(urls, results):
        print(f"{url}: {len(content)} chars")

asyncio.run(main())

Supported Sources

Source Loader Description
YouTube YoutubeLoader Extracts video transcripts
YouTube YoutubeYtdlpLoader Audio transcription via yt-dlp + Whisper
Twitter/X TwitterLoader Extracts tweet content
Truth Social TruthSocialLoader Extracts Truth Social posts
Reddit RedditLoader Extracts Reddit posts and comments
Instagram Reels ReelLoader Audio transcription + metadata
PDF PDFLoader Extracts text from PDF files (URL or local)
PTT PttLoader Taiwan PTT forum posts
Generic Web PlaywrightLoader Browser-based scraping for any website
Generic Web HttpxLoader Simple HTTP requests with markdown conversion

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

kabigon-0.12.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file kabigon-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: kabigon-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kabigon-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 682bfad2cb5b6b6965300bf4b1fa4992d3c411867c48581b2457fafcba1a82bf
MD5 8f9053beeb0103bb529772d301710fe4
BLAKE2b-256 0d957d0ddaeb0a0448bd94c8771937fdaf41436416ec011a7d06590c1e98bad4

See more details on using hashes here.

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