AYTCH is a Python library for extracting information about YouTube channels. It uses AIOHTTP library for best performance and concurrent fetching support. Library very lightweight (11KB) and return only extra nessesary information about any youtube channel.
You can install AYTCH using pip:
pip install aytch
Here's an example of how to use AYTCH to get information about a YouTube channel:
import asyncio
from aytch import get_channel_info
async def main():
channel_url = 'https://www.youtube.com/channel/UCdX9ulb8u0oUf8pUzg9Z5Jw'
channel_info = await get_channel_info(channel_url)
print(channel_info)
asyncio.run(main())
get_channel_info(
channel_url: str,
lang: 'en' | 'ru' = 'en'
) -> dict
Retrieves information about a YouTube channel.
- channel_url (str): The URL of the YouTube channel to get information about.
- lang (str): The language of the YouTube page. Can be either 'en' or 'ru'. Defaults to 'en'.
A dictionary containing the following information about the channel:
- author (str): The name of the channel's author.
- author_id (str): The external ID of the channel's author.
- author_url (str): The URL of the channel's author.
- author_thumbnail (str): The URL of the channel's author's thumbnail image.
- subscriber_count (int): The number of subscribers to the channel.
- description (str): The description of the channel.
- view_count (str): The total number of views on the channel.
Example:
{
'author': 'The Slow Mo Guys',
'author_id': 'UCUK0HBIBWgM2c4vsPhkYY4w',
'author_url': 'https://www.youtube.com/channel/UCUK0HBIBWgM2c4vsPhkYY4w',
'author_thumbnail': 'https://yt3.ggpht.com/ytc/AAUvwnhRnI8Lr...',
'subscriber_count': 14500000,
'description': 'The best slow motion on Youtube. \n\nWe shoot all of our...',
'view_count': '265308911'
}
Contributions to aytch are welcome! If you'd like to contribute, please fork the repository and make a pull request.
aytch is licensed under the MIT License. See LICENSE for more information.
Inspired by yt-channel-info