Skip to main content

yspy

Youtube.
Search..
PYthon..

Scrape YouTube search results, videos, channels, playlists and comments without the YouTube Data API v3. No API key required.

License: MIT Python: 3.10+ PyPI version


A refactored fork of youtube-search-python rebuilt around a clean-room code.

  • python >= 3.10
  • Sync (get_*, search, more, next) and async (aget_*, asearch, amore, anext) twins everywhere
    • Async is not just a wrapper for a sync API. Both have separate request paths.
  • Minimized unexpected network calls, behaviors

Install

Using uv & pip

pip install yspy # or: uv add yspy

Using pyproject.toml

[project]
dependencies = [
    "yspy"
]

Quick start (root / api layer)

from yspy import Search
from yspy.utils import SearchMode

# sync
search = Search.search('minecraft', SearchMode.VIDEO)
for video in search.videos:  # list[VideoResultElement]
    print(video.id, video.title)

# async
search = await Search.asearch('minecraft', SearchMode.PLAYLIST)
for playlist in search.playlists:  # list[PlaylistResultElement]
    print(playlist.title, playlist.channel_name)

SearchMode variants: VIDEO (default), CHANNEL, PLAYLIST, LIVESTREAM, or None(default) for mixed results.

Continuation pages follow the same rule everywhere: when there is no next page the call returns None instead of raising.

page = Search.search('minecraft', None)
while page is not None:
    print(len(page.videos), len(page.channels))
    page = page.more()  # None on the last page
# async: await page.amore()

Search results expose .videos, .channels, .playlists plus first_or / first_video_or / first_channel_or, and every element can fetch its own detail object (see below).

Video

from yspy import Video

video = Video.get('https://www.youtube.com/watch?v=6sFi_F3DJX4')  # id or URL
print(video.title, video.channel_name, video.view_count)

# async
video = await Video.aget('6sFi_F3DJX4')

# navigation
channel = await video.aget_channel()  # Video -> Channel
comments = await video.aget_comments()  # Video -> Comments

Channel

from yspy import Channel

channel = Channel.get('@sleepground')  # handle, URL, or UC... id
print(channel.handle_name, channel.approx_subscriber_count)

detail = await channel.aget_detail()  # Channel -> ChannelDetail
print(detail.joined_date, detail.view_count, detail.country)

Playlist

from yspy import Playlist

playlist = Playlist.get('PL...')  # PL/UU id, VL id or /playlist?list= URL
print(playlist.title, len(playlist.videos))

# walk all pages
page = await playlist.anext()  # None on the last page
# uploads of a channel — 'UU' + channel_id[2:]
uploads = await Playlist.aget_from_channel(channel_id_or_url='@sleepground')
# or reuse an already fetched Channel object
uploads2 = Playlist.get_from_channel(channel=channel)

video = await playlist.videos[0].aget_video()  # PlaylistVideo -> Video

Comments

from yspy import Comments

comments = Comments.get('6sFi_F3DJX4')
while comments is not None:
    print(len(comments.comments))
    comments = comments.more()  # None when the comment feed ends

Suggestions

from yspy import Suggestion

s = await Suggestion.aget('mine')
print([item.text for item in s.suggestions])

Locale

YouTube renders localized count formats (573K subscribers vs 구독자 57.3만명). Counts are parsed from the english rendering, so a non-english locale fetches the same page twice internally — the english copy is used only for count parsing.

from yspy import Video
from yspy.utils import Locale, Language, Region, NONE_LOCALE, ENGLISH_LOCALE

ko = Locale(language=Language.KOREAN, region=Region.SOUTH_KOREA)
video = await Video.aget('6sFi_F3DJX4', ko)

# every instance method keeps the stored locale by default:
await video.aget_channel()  # keeps ko
await video.aget_channel(NONE_LOCALE)  # explicitly no locale
await video.aget_channel(ENGLISH_LOCALE)  # override

NONE_LOCALE is the default value of every fetch argument — it sends no hl/gl and in this case, the YouTube api usually falls back to the server/IP locale.

Element Navigation
VideoResultElement get_video/aget_video, get_channel/aget_channel
ChannelResultElement get_channel/aget_channel
PlaylistResultElement get_playlist/aget_playlist, get_channel/aget_channel

All elements also have get_highest_res_thumbnail() and carry component_data (the underlying parsed component).

Layer map

ysps is separated in a few of layers followed by their functions and responsibilities:

Layer What it does
yspy.api Domain objects & navigation (Video, Channel, Playlist, Search, ...)
yspy.request HTTP layer — innertube calls, returns raw httpx.Response JSON
yspy.data_parsing Pure parsing — raw JSON → frozen dataclasses, no I/O
yspy.utils Locale, SearchMode, path helpers

Lower layers are public and importable, so you can access to request + data_parsing layer directly without touching innertube requests.

Credits

Based on youtube-search-python (MIT). This project is not affiliated with YouTube.

Metadata

Release files for yspy 0.1.0

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

Source distribution (sdist)

Source distribution for yspy 0.1.0
File Size Uploaded Provenance Actions
yspy-0.1.0.tar.gz 19.7 kB With provenance Details for yspy-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 58.0 kB

Release files / yspy-0.1.0.tar.gz

Download URL yspy-0.1.0.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cc5189b983f69be9890ef3b81d2b012e46884bbae1336a74f68a49a9bbcd1a9e
BLAKE2b-256 checksum
How to use checksums
e204994dff8002178396b08c60da26088e9c72f8fd1992cd2c9de0a1220c744c
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 7, 2026.

Transparency log

Release files / yspy-0.1.0-py3-none-any.whl

Download URL yspy-0.1.0-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d992ea15957c4c52348ba99141e5215c7fc2b3ea4d14835561532a218cebf4cd
BLAKE2b-256 checksum
How to use checksums
363fffbe81fe607ada3513e6e63d5cfce1890f21796a423fa8952ebdf89175b2
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 7, 2026.

Transparency log

Security for yspy 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yspy-0.1.0.tar.gz

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 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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