Skip to main content

SimpleSyntax

SimpleSyntax is a lightweight, CSS-selector-inspired Python library for downloading media and extracting metadata from various platforms.

It provides a clean, declarative API for media tasks with:

  • 🎯 CSS-inspired selectors
  • 🍪 Automatic cookie matching and fallback
  • 📥 Video and media downloading
  • 🖼️ Image fallback through gallery-dl
  • 🧾 Metadata extraction
  • 📋 Playlist downloading
  • 🔄 Successful URL/cookie history
  • 🐍 A simple Python API through rz()

Current Version

0.1.5

What's Fixed / Improved in 0.1.5

  • Fixed caller-scope variable assignment so values returned by rz() are available directly in the user's Python scope.
  • Fixed playlist request validation so QUALITY:SKIP:COUNT values such as "0:0:150" are correctly recognized as playlist configuration instead of being incorrectly validated as Python variable names.
  • Fixed playlist downloads using the existing QUALITY:SKIP:COUNT syntax and verified playlist requests can reach the downloader correctly.
  • Fixed metadata handling so extraction errors are printed as safe error messages instead of crashing the program with an unhandled exception.
  • Improved metadata failure handling so a failed metadata extraction returns safely without breaking a successful media fallback operation.
  • Improved cookie fallback handling with cookie ranking based on the target site's hostname and cookie filename.
  • Added a 40% cookie-match threshold so unrelated cookie files are skipped.
  • Added ordered cookie fallback attempts for matching cookie files.
  • Added successful URL/cookie history support through the helper file.
  • Preserved the ReiZyuki cookie-list API for user-supplied cookie files.
  • Improved media fallback flow between video downloading and image downloading.
  • Kept the CSS-inspired selector API and existing rz({...}, url) syntax unchanged.
  • Metadata selectors continue to support title, creator, URL, views, likes, comments, duration, thumbnail, date, and live status.

Requirements

  • Python >= 3.9
  • yt-dlp
  • gallery-dl
  • ffmpeg (required for merging audio/video streams)

Installation

pip install simplesyntax

The package installs its Python dependencies automatically. ffmpeg should be available separately when media merging is required.

Basic Usage

SimpleSyntax uses a single entry point, rz, with a CSS-inspired selector syntax:

from simplesyntax import rz

url = "https://example.com/video"

rz({
    "video[3]": "my_video",
    "title": "video_title"
}, url)

print(f"Downloaded: {my_video}")
print(f"Title: {video_title}")

Selector Syntax

Media Selectors

Media selectors support a quality index from 0 to 6:

  • video[N] — Downloads video/audio media.
  • media[N] — Attempts video downloading first and falls back to image downloading if the video engine cannot download the media.

Quality Index

Index Quality
0 Audio only
1 360p
2 480p
3 720p
4 1080p
5 1440p
6 Best quality

Example:

rz({"media[3]": "downloaded_media"}, url)
print(downloaded_media)

Metadata Selectors

The following metadata selectors are supported:

  • title
  • creator
  • url
  • views
  • likes
  • comments
  • duration
  • thumbnail
  • date (YYYY/MM/DD)
  • live

Example:

rz({
    "title": "title",
    "creator": "creator",
    "views": "views"
}, url)

print(title)
print(creator)
print(views)

SimpleSyntax supports optional cookie files through a variable named ReiZyuki in the caller's scope:

ReiZyuki = [
    "/path/to/youtube.txt",
    "/path/to/instagram.txt",
    "/path/to/reddit.txt"
]

The fallback system:

  1. Matches the target site's hostname against supplied cookie filenames.
  2. Calculates a cookie match score.
  3. Skips cookies below the 40% match threshold.
  4. Tries the best matching cookie first.
  5. Falls back to a no-cookie attempt when the matching cookie fails.
  6. Continues with the next matching cookie when necessary.
  7. Records successful URL/cookie associations in the helper history file.

No cookie files are scanned automatically; only paths supplied through ReiZyuki are used.

For reliable cookie matching, keep each cookie filename based on the target website's domain name. SimpleSyntax compares the target URL hostname with the cookie filename using similarity matching.

Recommended examples:

https://www.youtube.com/...      → youtube.txt
https://www.instagram.com/...    → instagram.txt
https://www.reddit.com/...       → reddit.txt
https://www.tiktok.com/...       → tiktok.txt

Avoid unrelated or generic names such as cookies.txt, mycookie.txt, login.txt, or account1.txt when possible.

For best results, use the website/domain name as the filename followed by .txt.

Media Fallback

media[N] is designed for URLs where the normal video downloader may not be able to retrieve a video.

The flow is:

media[N]
   │
   ├── Try video download (yt-dlp)
   │
   └── If video download fails
           │
           └── Try image download (gallery-dl)

This means a platform response such as "No video formats found" from yt-dlp does not necessarily mean the overall media[N] operation cannot succeed. If gallery-dl can retrieve an image, the media fallback can still complete successfully.

Playlist Handling

Playlist downloads use the existing QUALITY:SKIP:COUNT syntax:

rz({"playlist": "3:0:5"}, url)

This downloads 5 items starting from index 0 using quality index 3 (720p).

Project & Creator

Project: SimpleSyntax
Creator / YouTube: ReiZyuki

SimpleSyntax is developed under the ReiZyuki name.

Bug Reports & Help

If you find a bug, need help using SimpleSyntax, or have a problem with a selector or downloader, contact:

Email: Azadofficial2026@gmail.com

When reporting an issue, it helps to include:

  • Python version
  • SimpleSyntax version
  • Platform/URL type
  • The selector you used
  • The relevant error or terminal output

Please avoid sharing private cookie contents in bug reports.

Notes

Some platforms may still require valid cookies or may restrict automated access. A platform-side HTTP/API restriction does not necessarily indicate a SimpleSyntax selector or fallback error.

Cookie files are user-supplied and should be kept private. Never publish or share your cookie file contents.


Author / YouTube: ReiZyuki
Contact: Azadofficial2026@gmail.com
SimpleSyntax 0.1.5

Metadata

Release files for simplesyntax 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplesyntax 0.1.5
File Size Uploaded
simplesyntax-0.1.5.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simplesyntax 0.1.5
File Interpreter ABI Platform
simplesyntax-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 28.4 kB

Release files / simplesyntax-0.1.5.tar.gz

Download URL simplesyntax-0.1.5.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f86d212f5ca2af342955551ad03137252fcfe8895ec03e78c9e155823182752a
BLAKE2b-256 checksum
How to use checksums
791d9bf0e64c52324f13f215aae9c80a72cccdc01c0636d0a977a79815c4213a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / simplesyntax-0.1.5-py3-none-any.whl

Download URL simplesyntax-0.1.5-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee5fc7b143c4027ceb6f5e4ed5957a4c6d1e50bb17c12f876667e9400332fe5d
BLAKE2b-256 checksum
How to use checksums
bb19ab95ae60311c841ae3872d5643e873eb5e03f7b7af7d669989224a49b87d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page