SDK for interacting with YouTube Search API
Project description
YouTube Search SDK
A Python SDK for interacting with the YouTube Search API. This SDK provides a simple and intuitive interface to search for YouTube videos with various parameters.
Features
- Simple and intuitive API
- Type hints and documentation
- Pydantic models for response validation
- Context manager support for proper resource cleanup
- Configurable API endpoint
Installation
pip install youtube-search-sdk
Quick Start
from youtube_search_sdk import YouTubeSearchClient
# Create a client
client = YouTubeSearchClient(base_url="http://your-api-url:8000")
# Basic search
results = client.search("Python programming")
# Search with parameters
results = client.search(
query="Python programming",
limit=10, # results per page (1-50)
pages=2 # number of pages (1-10)
)
# Using context manager (recommended)
with YouTubeSearchClient() as client:
results = client.search("Python programming")
for video in results:
print(f"Title: {video.title}")
print(f"Channel: {video.channel_name}")
print(f"Link: {video.link}")
print("---")
Response Structure
Each search result includes:
class VideoResult:
title: str
channel_name: str
duration: str
views: str
publish_date: Optional[datetime]
link: str
description: Optional[str]
keywords: Optional[List[str]]
page_number: int
Error Handling
The SDK provides clear error messages for common issues:
try:
results = client.search("", limit=100)
except ValueError as e:
print(f"Invalid parameters: {e}")
except httpx.HTTPError as e:
print(f"API request failed: {e}")
Development
To set up the development environment:
# Clone the repository
git clone https://github.com/yourusername/youtube-search-sdk
cd youtube-search-sdk
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file youtube_search_sdk-0.1.0.tar.gz.
File metadata
- Download URL: youtube_search_sdk-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
341ec108a8f3abc4256e69f0b67c1c1bffea89032e4f61456061f1995945f770
|
|
| MD5 |
4c2662c0334e8c4db3c907d2fe8d6132
|
|
| BLAKE2b-256 |
175ae970eec36fe2721515e1b9c5e2352aeb9defbc31743482a29a6344ac1e4b
|
File details
Details for the file youtube_search_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: youtube_search_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4482310b2473fe760c485a254eb008581a7a9d16da2707cffe9cec8c89a47e3
|
|
| MD5 |
774e64f10e571d65453bbf76580413df
|
|
| BLAKE2b-256 |
ec9a1c8c684ca16e4716e1990d96d93215558772455906742b3454b3025f9778
|