Skip to main content

irotechlab-yt-search

PyPI version Python 3.7+ License: MIT

YouTube search without official API - fast, reliable, and completely free.

📌 Features

  • 🔍 Search videos, channels, and playlists without API key
  • ⚡ Async/await support for high performance
  • 🎯 Filter by type (video, channel, playlist, live, movie)
  • 📊 Sort by relevance, upload date, view count, rating
  • 🌍 Region and language support
  • 🔄 Pagination for unlimited results
  • 📹 Video info extraction (title, channel, views, likes, comments)
  • 💬 Comment scraping with replies
  • 📑 Chapter extraction
  • 🛡️ Rate limiting and retry logic
  • 📦 Clean dataclass models (Video, Channel, Playlist)

📦 Installation

pip install irotechlab-yt-search

Or install from source:

git clone https://github.com/irotechlab/irotechlab-yt-search
cd irotechlab-yt-search
pip install -e .

🚀 Quick Start

import asyncio
from irotechlab_yt_search import YouTubeSearch

async def main():
    search = YouTubeSearch()
    
    # Search for videos
    videos = await search.search("python programming", max_results=5)
    
    for video in videos:
        print(f"{video.title}")
        print(f"  Channel: {video.channel}")
        print(f"  Views: {video.views}")
        print(f"  URL: {video.url}\n")
    
    await search.close()

asyncio.run(main())

📹 Video Info

from irotechlab_yt_search import VideoInfo, extract_video_id

async def get_video_info():
    info = VideoInfo()
    
    video_url = "https://youtube.com/watch?v=VIDEO_ID"
    video_id = extract_video_id(video_url)
    
    details = await info.get_video_info(video_id)
    
    print(f"Title: {details['title']}")
    print(f"Views: {details['views']}")
    print(f"Likes: {details['likes']}")
    print(f"Comments: {details['comment_count']}")
    
    await info.close()

📺 Channel Info

from irotechlab_yt_search import ChannelInfo

async def get_channel():
    channel_info = ChannelInfo()
    channel = await channel_info.get_channel_info("@channelname")
    
    print(f"Name: {channel['name']}")
    print(f"Subscribers: {channel['subscribers']}")
    print(f"Videos: {channel['video_count']}")
    
    await channel_info.close()

📋 Playlist Info

from irotechlab_yt_search import PlaylistInfo

async def get_playlist():
    playlist_info = PlaylistInfo()
    playlist = await playlist_info.get_playlist_info("PLAYLIST_ID", max_videos=10)
    
    print(f"Title: {playlist['title']}")
    print(f"Author: {playlist['author']}")
    print(f"Videos: {playlist['video_count']}")
    
    for video in playlist['videos']:
        print(f"  - {video['title']}")
    
    await playlist_info.close()

🔍 Advanced Search

Filter by type

# Only videos
videos = await search.search(
    "python tutorial",
    filter_type="video",
    max_results=10
)

Sort results

# Sort by view count
videos = await search.search(
    "python tutorial",
    sort_by="view_count"
)

# Sort by upload date
videos = await search.search(
    "python tutorial",
    sort_by="upload_date"
)

Region and language

videos = await search.search(
    "python tutorial",
    region_code="IN",
    language="hi"
)

🛠️ API Reference

YouTubeSearch

Parameters:

  • query (str): Search query
  • max_results (int): Maximum number of results (default: 10)
  • filter_type (str): all, video, channel, playlist, movie, live
  • sort_by (str): relevance, upload_date, view_count, rating
  • region_code (str): Two-letter country code
  • language (str): Language code

Returns: List[Video]

Video Object

@dataclass
class Video:
    id: str
    title: str
    channel: str
    channel_id: Optional[str]
    url: str
    thumbnail: str
    duration: str
    duration_seconds: Optional[int]
    views: str
    view_count: Optional[int]
    published: str
    published_date: Optional[datetime]
    is_live: bool

📂 Examples

Check the examples/ directory for more usage examples:

  • basic_search.py - Simple search
  • advanced_search.py - Advanced filtering and sorting
  • all_in_one.py - Complete demo of all features

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📞 Support & Community

📄 License

MIT License - see LICENSE file for details

⚠️ Disclaimer

This package scrapes YouTube's internal API and may break if YouTube changes their structure. Use responsibly and respect YouTube's terms of service.


Made with ❤️ by IrotechLab

Metadata

Release files for irotechlab-yt-search 1.0.1

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

Source distribution (sdist)

Source distribution for irotechlab-yt-search 1.0.1
File Size Uploaded
irotechlab_yt_search-1.0.1.tar.gz 26.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for irotechlab-yt-search 1.0.1
File Interpreter ABI Platform
irotechlab_yt_search-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.8 kB

Release files / irotechlab_yt_search-1.0.1.tar.gz

Download URL irotechlab_yt_search-1.0.1.tar.gz
Size 26.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f8ed8c07d8442f390b72072f7614368c3668a66fcf3b745c6ed3642da0da972d
BLAKE2b-256 checksum
How to use checksums
b03b3a0989f2b167e3d6c888b625d3b2969c5f6506113eb24e8739711c188bb9
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 Aug 10, 2026.

Transparency log

Release files / irotechlab_yt_search-1.0.1-py3-none-any.whl

Download URL irotechlab_yt_search-1.0.1-py3-none-any.whl
Size 29.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5de534f11b7a62edb9b1b4c06b3cc2d9cd5b53fb963639bc7953411fb78975c2
BLAKE2b-256 checksum
How to use checksums
f3eab97a6a0edd30ca7deb786d4a6bb1234712450bac2aa3538bf120f7e3bd45
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 Aug 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

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