Python Async v1.7.6

Beeg API

Fetch Beeg video metadata, download HLS streams, and read account libraries from an authorized Beeg session.

GitHub
⚡ Recommended AI Workflow Official MCP Server: https://mcp.echteralsfake.me/mcp

Supercharge your development by connecting your AI coding assistant (Cursor, VS Code / Copilot, Claude Desktop, Windsurf, Zed, Antigravity). No authentication required · No strict rate limits · Covers all 16 APIs · Always up to date · Completely anonymous (0 logs, no profiling). Connecting this MCP server to your AI assistant is absolutely the recommended way to work on and build with these APIs.

⚠️ Legal Disclaimer
I maintain this independent project. It is not affiliated with, endorsed by, or sponsored by the supported website. Use only content and accounts you are entitled to access, and respect applicable laws, platform terms and third-party rights. The software does not grant rights to download or redistribute content. My statutory responsibilities and liability remain unaffected.
💚 Support & Commercial Licensing
If you find this project helpful, please consider donating to support its continued development!

Other Options:
• PayPal
• Ko-Fi

For extended features, enterprise integrations, or custom commercial licensing, please contact support@echteralsfake.me.

📦 Installation

Install from PyPI using pip:

bash
pip install unofficial-api-for-beeg

For TS→MP4 remuxing and metadata tagging support (recommended for HLS downloads with remux=True), ensure ffmpeg is installed on your system PATH (or set RuntimeConfig.ffmpeg_path).

Note
Requires Python ≥ 3.12. eaf-base-api>=4.3.0 is installed automatically as a dependency.

Release 1.7.6 requires eaf-base-api>=4.3.0 from PyPI. A local base-API checkout is not required.

🚀 Quick Start

Every method in this API is asynchronous. You need to run your code inside an async function:

python
import asyncio
from beeg_api import Client

async def main():
    client = Client()

    # Fetch a video
    video = await client.get_video("https://beeg.com/1234567")

    # Access metadata
    print(video.title)
    print(video.duration)

    # Download the video
    from base_api import DownloadConfigHLS
    config = DownloadConfigHLS(quality="best", path="./downloads")
    await video.download(configuration=config)

asyncio.run(main())

⚙️ Configuration

The entire API relies on eaf_base_api for its networking. You can configure global settings (proxies, timeouts, etc.) via a custom BaseCore passed into the Client.

Please refer to the eaf_base_api Documentation for the complete reference on how to set up RuntimeConfig and properly integrate it with this API.

python
from base_api import BaseCore
from base_api.modules.config import RuntimeConfig
from beeg_api import Client

my_config = RuntimeConfig()
my_config.proxy = "socks5://127.0.0.1:9050"
my_config.request_attempts = 4

core = BaseCore(configuration=my_config)
client = Client(core=core)
eaf_base_api 4
Version 1.7.3 uses the v4 request and source-aware media contracts. RuntimeConfig.proxy is a single proxy URL (the old proxies mapping was removed), and request retries are configured with request_attempts plus the request_retry_* settings.

🔌 Client

URL handling

This version requires eaf-base-api>=4.3.0. The numeric video ID is extracted only from the URL path. Leading signs and padding are normalized, while meaningful trailing zeros are preserved. Trailing slashes, query parameters, and fragments do not become part of the ID.

The Client class is the entry point for all API requests. It initializes and manages the networking core to request video information pages.

python
from beeg_api import Client
from base_api import BaseCore

client = Client()

# Or initialize with custom core config
client_custom = Client(core=BaseCore())

Constructor Parameters

  • core BaseCore — Networking core instance (default: BaseCore())

Methods

Fetch Video get_video()

async
Fetches a video profile and returns a populated Video object. Queries Beeg's external store endpoints to obtain video parameters.
await client.get_video( url: str, load_api: bool = True )

Parameters

  • url str — The full Beeg video URL
  • load_api bool — If True (default), fetches and parses the JSON metadata API response

Returns

→ Video
Source-aware fields
With load_api=True, all remote fields are loaded from the "api" source. If you construct a lightweight object with load_api=False, call await video.load_sources("api"), await video.load_fields("title", "duration"), or await video.get_field("title") before reading unresolved fields. Direct unresolved access raises DataNotLoadedError; a real loaded None does not.

Accepted video links

get_video() accepts a complete Beeg URL, a protocol-relative URL, a URL without a scheme, or a bare video ID. Tag-scoped links, optional trailing slugs, query strings and fragments are normalized before the API key is extracted. Malformed or missing API records raise NotFound.

Account login and libraries

Account support was added in Beeg API 1.7.6 and requires eaf-base-api>=4.3.0. Install the browser extra with pip install 'unofficial-api-for-beeg[browser]>=1.7.6' and sign in to Beeg in your browser.

await client.login_from_browser(browser=None) reads local cookies with the optional browser-cookie3 dependency. Pass a browser name such as "brave" to select it. Applications that already manage sessions can call await client.login(cookies) with a CookieJar or a mapping containing refreshToken. Both methods return an Account and set client.account on success. The API keeps tokens in memory and renews the access token when Beeg rejects it.

import asyncio

from base_api import BaseCore
from beeg_api import Client


async def main():
    async with BaseCore() as core:
        client = Client(core=core)
        account = await client.login_from_browser("brave")
        async with account.get_liked_videos(pages="all") as videos:
            async for result in videos:
                print(result.unwrap().url)


asyncio.run(main())

The account exposes four read-only video streams through get_saved_videos(), get_liked_videos(), get_watch_later_videos(), and get_following_videos(). Each accepts pages=1 (or "all"), start_page=1 (one-based), and an optional iterator_config. Use result.unwrap() to get the Video or raise the result's error. Videos are lazy by default. Call await video.load_sources("api") or configure load_specific_sources=("api",) in the iterator to load metadata.

await account.get_followed_creators() returns a list of followed performers and studios as FollowedCreator objects with id, name, slug, kind, and url.

Catch beeg_api.AuthenticationError for a missing or rejected login cookie or when Beeg denies account access after renewal. Sign in to Beeg in the browser again and supply a fresh session. A valid empty collection ends without yielding results.

🎬 Video

owners and people are lists of names from API owner and person tags. The existing author and tags fields are still available.

dataclass Inherits from BaseMedia. Represents a single video with details extracted from Beeg's store facts API.

Attributes

AttributeTypeDescription
urlstrThe video page URL
titlestr | NoneVideo title
video_idint | str | NoneUnique video file ID
durationint | NoneVideo duration in seconds
m3u8_base_urlstr | NoneMaster HLS stream playlist URL
keystr | NoneVideo key extracted from the URL path

Methods

Download Video download()

async
Downloads the video via HLS streaming. Appends the video title to the output path unless no_title=True on the config.
await video.download( configuration: DownloadConfigHLS ) -> bool | DownloadReport

Parameters

Returns

→ bool | DownloadReport

Additional metadata

Alongside the title and duration, Video exposes tags: list[str] | None, author: str | None, thumbnail: str | None and publish_date: str | None from its api source. video_id can be an integer or string. Author metadata can be absent when the upstream tags do not identify an owner or performer.

⬇️ Downloading Options

Beeg video downloads are HLS-only. Configure stream downloads via DownloadConfigHLS:

python
from base_api import DownloadConfigHLS

config = DownloadConfigHLS(
    quality="best",            # "best", "half", "worst", or height int
    path="./downloads",        # Destination path
    no_title=False,            # If False, automatically appends title + ".mp4"
    return_report=True         # Return a DownloadReport instead of bool
)

report = await video.download(configuration=config)

For full details on download options and setup configurations, see the eaf_base_api Documentation.

⚠️ Error Handling

Source loaders translate request failures into exceptions from beeg_api.modules.errors. Calls that load media expose ordinary loader failures through base_api.MediaLoadError (or MediaLoadErrors for several sources); inspect original_error/errors as shown. Operations outside media loading may still raise package or core exceptions directly.

Request and download failures are logged with the operation, target URL, and full original traceback. Translated exceptions retain the original error in __cause__. Download preparation failures (including metadata loading, quality selection, and output path setup) are also wrapped in DownloadFailed; inspect its cause when diagnosing a failure. The specific availability exceptions listed below remain supported. An explicit DownloadCancelled or asyncio.CancelledError propagates without being wrapped in DownloadFailed. Base downloader False and DownloadReport results remain supported; inspect the result as well as handling exceptions.

The common provider errors NotFound, NetworkError, BotDetection, ProxyError, UnknownNetworkError, and DownloadFailed are catchable through base_api.modules.errors. They derive from ScraperException, which now derives from BaseScraperError. Existing provider import paths remain valid.

See Logging & Cleanup for application logging setup.

ExceptionTrigger Cause
NotFoundServer returned HTTP 404 (e.g. video deleted)
NetworkErrorRequest failed due to a network error, exhausted request retries, or a non-404 HTTPStatusError
BotDetectionBot-protection challenge block detected
ProxyErrorProxy connection failed
UnknownNetworkErrorUnexpected network errors
DownloadFailedDownload preparation or transfer failed; the video URL is included and __cause__ retains the original exception
python
from base_api import MediaLoadError
from beeg_api.modules.errors import NotFound

try:
    video = await client.get_video(url)
except MediaLoadError as error:
    if isinstance(error.original_error, NotFound):
        print("This video was not found on Beeg!")
    else:
        raise

💻 CLI Usage

The CLI entry point configures console logging at INFO level. Caught per-URL failures include the URL and full traceback; the default log format shows the logger, file, line, and function. Library applications should configure logging once at startup.

Beeg API includes a command-line interface accessible via beeg_api or python -m beeg_api:

bash
# Download a single video
beeg_api --download "https://beeg.com/1234567" --quality best --output ./downloads --no-title False

# Or invoke via python -m
python -m beeg_api --download "https://beeg.com/1234567" --quality best --output ./downloads --no-title False

# Download from a line-separated file of URLs
beeg_api --file urls.txt --quality best --output ./downloads --no-title False

CLI Options

FlagDescription
--download URLVideo URL to download
--file FILEText file with URLs (separated by newlines)
--quality QUALITYVideo quality: best, half, worst
--output DIRDestination directory or output file path
--no-title True/FalseSkip auto-appending video title to output filename (default: False)

🖥️ Supported Platforms

PlatformArchitectureStatus
Windows 11x64✅ Tested
macOS Sequoiax86_64✅ Tested
Linux (Arch)x86_64✅ Tested
Android 16aarch64✅ Tested

📜 Changelog

1.7.6 — 2026-11-26

  • Read Saved, Liked, Watch Later, Following, and followed creators from a signed-in Beeg session.

1.7.5 — 2026-11-14

  • Keep the typed owner and person tags alongside the existing author and tags fields for metadata export.

1.7.4 — 2026-10-27

  • Accept video IDs, links without a scheme, and video links copied from tag pages without losing the video key.
  • Expose author, tags, thumbnails and publication dates from the API response.
  • Report missing or malformed metadata as NotFound instead of failing with an indexing error.
  • Handle missing batch files and output directories more gracefully in the CLI.

GitHub release and distribution files · PyPI 1.7.4

Uses the published eaf-base-api>=4.2.5 dependency.

1.7 — September 15, 2026

  • 6bd391b / c5a4549 / 05837ac — Adopted shared request and download error handling from base_api.modules.provider (requiring eaf-base-api>=4.2.0). Failed downloads now raise DownloadFailed with complete context. Added CLI support with automatic console logging, exception chaining, and contextual logging.

1.7 — August 11, 2026

  • 9eb18ac — Added complete public type hints and the py.typed marker, updated package metadata for 1.7, and reverted the temporary exact-suffix ID parsing change. The current implementation again uses strip("-0").

Changes during August 7–10, 2026

  • 3f3f68d (August 7) — Migrated to eaf_base_api 4: explicit request methods, source-aware media_field("api") loaders, strict loader results, and removal of the v3 compatibility code.
  • 2c0a098 (August 9) — Temporarily changed Beeg ID parsing to remove only the exact "-0" suffix.
  • 41d4443 (August 10) — Merged that temporary ID parsing change; it was subsequently reverted by 9eb18ac.