### Install Holodex Package (Shell) Source: https://github.com/ombe1229/holodex/blob/master/README.md Provides the command to install the holodex Python package using pip. This is the standard method for installing Python libraries. ```bash python -m pip install holodex ``` -------------------------------- ### Holodex API Client Usage (Python) Source: https://github.com/ombe1229/holodex/blob/master/README.md Demonstrates how to use the HolodexClient to interact with the Holodex API. It shows examples of searching for channels, retrieving channel details, fetching videos from a channel, and listing channels. This requires an asynchronous context. ```python import asyncio from holodex.client import HolodexClient async def main(): async with HolodexClient() as client: search = await client.autocomplete("iofi") channel_id = search.contents[0].value print(channel_id) channel = await client.channel(channel_id) print(channel.name) print(channel.subscriber_count) videos = await client.videos_from_channel(channel_id, "videos") print(videos.contents[0].title) channels = await client.channels(limit=100) print(channels[0].name) print(channels[0].subscriber_count) asyncio.run(main()) """ UCAoy6rzhSf4ydcYjJw3WoVg Airani Iofifteen Channel hololive-ID 508000 Freetalk dan Terima Kasih Superchat! + Risu OG Song React?! Nanashi Mumei Ch. hololive-EN 528000 """ ``` -------------------------------- ### Autocomplete Search with Holodex API Source: https://context7.com/ombe1229/holodex/llms.txt Performs an autocomplete search to find channels, topics, or other entities. It uses the HolodexClient to get typeahead suggestions and then retrieves details for the first matching channel. Requires the 'holodex' library. ```python import asyncio from holodex.client import HolodexClient async def search_autocomplete(): async with HolodexClient() as client: search = await client.autocomplete("iofi") print("Autocomplete results:") for result in search.contents: print(f"Type: {result.type}") print(f"Value: {result.value}") print(f"Text: {result.text}") print() # Use first result to get channel details if search.contents: channel_id = search.contents[0].value channel = await client.channel(channel_id) print(f"Selected: {channel.name} - {channel.subscriber_count} subscribers") asyncio.run(search_autocomplete()) ``` -------------------------------- ### Initialize HolodexClient Source: https://context7.com/ombe1229/holodex/llms.txt Demonstrates how to initialize the HolodexClient, both with and without an API key. The client can be used with an async context manager for proper session handling. Using an API key provides higher rate limits. ```python import asyncio from holodex.client import HolodexClient async def main(): # Without API key (limited rate limits) async with HolodexClient() as client: channel = await client.channel("UCAoy6rzhSf4ydcYjJw3WoVg") print(f"{channel.name}: {channel.subscriber_count} subscribers") # With API key (higher rate limits) async with HolodexClient(key="your-api-key-here") as client: channels = await client.channels(limit=10, org="Hololive") for ch in channels: print(f"{ch.name}: {ch.subscriber_count} subs") asyncio.run(main()) ``` -------------------------------- ### List Channels with Filters Source: https://context7.com/ombe1229/holodex/llms.txt Demonstrates how to query multiple VTuber channels using various parameters like limit, offset, type, organization, sort order, and sort field. This allows for browsing and filtering channels effectively. ```python import asyncio from holodex.client import HolodexClient async def list_channels(): async with HolodexClient() as client: # Get Hololive channels sorted by subscriber count channels = await client.channels( limit=100, offset=0, type="vtuber", org="Hololive", sort="subscriber_count", order="desc" ) print(f"Found {len(channels)} channels:\n") for i, channel in enumerate(channels[:10], 1): print(f"{i}. {channel.name} ({channel.english_name})") print(f" Org: {channel.org}/{channel.suborg}") print(f" Subscribers: {channel.subscriber_count:,}") print(f" Videos: {channel.video_count}, Clips: {channel.clip_count}") print() asyncio.run(list_channels()) ``` -------------------------------- ### Async API Requests with Session Reuse and Error Handling (Python) Source: https://context7.com/ombe1229/holodex/llms.txt Demonstrates how to make concurrent asynchronous API requests using aiohttp and the HolodexClient, while managing sessions and handling potential errors. It shows reusing an aiohttp ClientSession for efficiency and includes specific exception handling for HTTP errors, unexpected API formats, and general exceptions. ```python import asyncio from aiohttp import ClientSession, ClientError from holodex.client import HolodexClient async def robust_client_usage(): try: # Reuse aiohttp session across requests async with ClientSession() as session: client = HolodexClient(key="your-api-key", session=session) try: # Multiple concurrent requests channel_task = client.channel("UCAoy6rzhSf4ydcYjJw3WoVg") videos_task = client.videos_from_channel( "UCAoy6rzhSf4ydcYjJw3WoVg", "videos", limit=10 ) live_task = client.live_streams(org="Hololive", limit=5) channel, videos, live = await asyncio.gather( channel_task, videos_task, live_task ) print(f"Channel: {channel.name}") print(f"Videos: {len(videos.contents)}") print(f"Live streams: {len(live.contents)}") except ClientError as e: print(f"HTTP request failed: {e}") except KeyError as e: print(f"Unexpected API response format: {e}") except Exception as e: print(f"Unexpected error: {e}") finally: await client.close() except Exception as e: print(f"Session initialization failed: {e}") asyncio.run(robust_client_usage()) ``` -------------------------------- ### Fetch Video Information with Holodex API Source: https://context7.com/ombe1229/holodex/llms.txt Retrieves comprehensive details for a specific video, including metadata, related clips, references, comments, and recommendations. Requires the 'holodex' library. ```python import asyncio from holodex.client import HolodexClient async def get_video_info(): async with HolodexClient() as client: video = await client.video("fLAcgHX160k") print(f"Title: {video.title}") print(f"Type: {video.type}") print(f"Channel: {video.channel.name}") print(f"Status: {video.status}") print(f"Duration: {video.duration}s") print(f"Published: {video.published_at}") print(f"Available: {video.available_at}") print(f"Description: {video.description[:200]}...") print() print(f"Related Clips ({len(video.clips)}):") for clip in video.clips[:3]: print(f" - {clip.title} by {clip.channel.name}") print() print(f"Refers to ({len(video.refers)}):") for refer in video.refers[:3]: print(f" - {refer.title} ({refer.type})") print() print(f"Top Comments ({len(video.comments)}):") for comment in video.comments[:5]: print(f" - {comment.message[:80]}...") print() print(f"Recommendations ({len(video.recommendations)}):") for rec in video.recommendations[:3]: print(f" - {rec.title} by {rec.channel.name}") asyncio.run(get_video_info()) ``` -------------------------------- ### Fetch Channel Videos with Holodex Client (Python) Source: https://context7.com/ombe1229/holodex/llms.txt Retrieves recent videos, clips, and collaborations from a specified channel using the Holodex API client. It supports pagination and filtering by video type. Requires the 'holodex' library. ```python import asyncio from holodex.client import HolodexClient async def get_channel_videos(): async with HolodexClient() as client: channel_id = "UCAoy6rzhSf4ydcYjJw3WoVg" # Get recent videos videos = await client.videos_from_channel( channel_id=channel_id, type="videos", lang="all", limit=50, offset=0 ) print("Recent Videos:\n") for video in videos.contents[:10]: print(f"Title: {video.title}") print(f"Type: {video.type}") print(f"Status: {video.status}") print(f"Published: {video.published_at}") print(f"Duration: {video.duration}s") print(f"Channel: {video.channel.name}") print() # Get clips of this channel clips = await client.videos_from_channel( channel_id=channel_id, type="clips", limit=20 ) print(f"\nFound {len(clips.contents)} clips") # Get collaborations collabs = await client.videos_from_channel( channel_id=channel_id, type="collabs", limit=10 ) print(f"Found {len(collabs.contents)} collaborations") asyncio.run(get_channel_videos()) # Output: # Recent Videos: # # Title: Freetalk dan Terima Kasih Superchat! + Risu OG Song React?! # Type: stream # Status: past # Published: 2023-05-10T12:00:00.000Z # Duration: 7200s # Channel: Airani Iofifteen Channel hololive-ID ``` -------------------------------- ### Search Videos with Holodex Client (Python) Source: https://context7.com/ombe1229/holodex/llms.txt Searches for videos using the Holodex API client with advanced filtering options. Supports filtering by text content, topics, channels, organizations, and sort order. Requires the 'holodex' library. ```python import asyncio from holodex.client import HolodexClient async def search_videos(): async with HolodexClient() as client: results = await client.search_video( offset=0, limit=25, sort="newest", lang="en", target="stream", conditions=[ {"text": "minecraft"}, {"text": "building"} ], topic=["gaming", "minecraft"], org=["Hololive"], vch=None # Specific channel IDs if needed ) print(f"Found {len(results.items)} videos:\n") for item in results.items[:5]: print(f"Title: {item.title}") print(f"Channel: {item.channel.name}") print(f"Type: {item.type}") print(f"Status: {item.status}") print(f"Published: {item.published_at}") print(f"Duration: {item.duration}s") print(f"Live Viewers: {item.live_viewers}") print(f"Description: {item.description[:100] if item.description else 'N/A'}...") print() asyncio.run(search_videos()) # Output: # Found 25 videos: # # Title: 【MINECRAFT】Building the Ultimate Base! # Channel: Gawr Gura Ch. hololive-EN # Type: stream # Status: past # Published: 2023-05-14T18:00:00.000Z # Duration: 10800s # Live Viewers: None # Description: Today we're going to build something amazing in Minecraft! Join me as we create... ``` -------------------------------- ### Retrieve Live Streams with Holodex API Source: https://context7.com/ombe1229/holodex/llms.txt Fetches currently live, upcoming, or past live streams using the Holodex API. Allows filtering by status, organization, language, and sorting options. Requires the 'holodex' library. ```python import asyncio from holodex.client import HolodexClient async def get_live_streams(): async with HolodexClient() as client: # Get currently live Hololive streams live = await client.live_streams( status="live", org="Hololive", lang="en", limit=20, max_upcoming_hours=48, sort="start_actual", order="desc" ) print("Currently Live Streams:\n") for stream in live.contents: print(f"Title: {stream.title}") print(f"Channel: {stream.channel.name}") print(f"Status: {stream.status}") print(f"Live Viewers: {stream.live_viewers:,}") print(f"Started: {stream.start_actual or stream.start_scheduled}") print(f"Duration: {stream.duration}s") print(f"URL: https://youtube.com/watch?v={stream.id}") print(f"TL Count: {stream.live_tl_count}") print() asyncio.run(get_live_streams()) ``` -------------------------------- ### Retrieve Channel Details Source: https://context7.com/ombe1229/holodex/llms.txt Shows how to fetch detailed information for a specific VTuber channel using its ID. The output includes various attributes like name, organization, subscriber count, video count, and social links. ```python import asyncio from holodex.client import HolodexClient async def get_channel_details(): async with HolodexClient() as client: channel = await client.channel("UCCzUftO8KOVkV4wQG1vkUvg") print(f"Name: {channel.name}") print(f"English Name: {channel.english_name}") print(f"Organization: {channel.org}") print(f"Sub-organization: {channel.suborg}") print(f"Subscribers: {channel.subscriber_count}") print(f"Total Videos: {channel.video_count}") print(f"Total Clips: {channel.clip_count}") print(f"Twitter: {channel.twitter}") print(f"Photo URL: {channel.photo}") print(f"Created: {channel.created_at}") print(f"Top Topics: {', '.join(channel.top_topics or [])}") asyncio.run(get_channel_details()) ``` -------------------------------- ### Search Comments with Holodex Client (Python) Source: https://context7.com/ombe1229/holodex/llms.txt Searches for video comments using the Holodex API client, allowing filtering by text content, channels, topics, and organizations. It returns videos that contain matching comments and excerpts of those comments. Requires the 'holodex' library. ```python import asyncio from holodex.client import HolodexClient async def search_comments(): async with HolodexClient() as client: results = await client.search_comment( comment="cute", offset=0, limit=20, sort="newest", lang=["en", "ja"], target=["stream"], topic=["gaming"], org=["Hololive"], vch=None # Filter by specific channels if needed ) print(f"Found {len(results.items)} videos with matching comments:\n") for item in results.items[:5]: print(f"Video: {item.title}") print(f"Channel: {item.channel.name}") print(f"Type: {item.type}") print(f"Published: {item.published_at}") print() print("Matching Comments:") for comment in item.comments[:3]: print(f" [{comment.comment_key}] {comment.message}") print(f" ... ({len(item.comments)} total comments)") print() asyncio.run(search_comments()) # Output: # Found 20 videos with matching comments: # # Video: 【MINECRAFT】Building the EN Server! # Channel: Gawr Gura Ch. hololive-EN # Type: stream # Published: 2023-05-15T14:30:00.000Z # # Matching Comments: # [abc123] This is so cute! Love the design! # [def456] Cutest base ever built # [ghi789] The decorations are really cute # ... (12 total comments) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.