SlyYTDAPI.ytdapi#

Functions

get_dict_path(d, *keys)

yt_date(date)

Classes

Channel(source, yt)

Comment(source)

CommentOrder(value)

An enumeration.

Order(value)

An enumeration.

Part(value)

An enumeration.

Playlist(id, yt)

PrivacyStatus(value)

An enumeration.

SafeSearch(value)

An enumeration.

Scope()

Video(source, yt)

YouTubeData(app_or_api_key)

class SlyYTDAPI.ytdapi.Scope[source]#

Bases: object

READONLY = 'https://www.googleapis.com/auth/youtube.readonly'#
MEMBERS = 'https://www.googleapis.com/auth/youtube.channel-memberships.creator'#
class SlyYTDAPI.ytdapi.Part(value)[source]#

Bases: Enum

An enumeration.

ID = 'id'#
DETAILS = 'contentDetails'#
SNIPPET = 'snippet'#
STATUS = 'status'#
STATISTICS = 'statistics'#
REPLIES = 'replies'#
class SlyYTDAPI.ytdapi.PrivacyStatus(value)[source]#

Bases: Enum

An enumeration.

PRIVATE = 'private'#
UNLISTED = 'unlisted'#
PUBLIC = 'public'#
class SlyYTDAPI.ytdapi.SafeSearch(value)[source]#

Bases: Enum

An enumeration.

SAFE = 'strict'#
MODERATE = 'moderate'#
UNSAFE = 'none'#
class SlyYTDAPI.ytdapi.Order(value)[source]#

Bases: Enum

An enumeration.

DATE = 'date'#
LIKES = 'rating'#
RELEVANCE = 'relevance'#
ALPHABETICAL = 'title'#
VIEWS = 'viewCount'#
class SlyYTDAPI.ytdapi.CommentOrder(value)[source]#

Bases: Enum

An enumeration.

RELEVANCE = 'relevance'#
TIME = 'time'#
SlyYTDAPI.ytdapi.yt_date(date)[source]#
Parameters:

date (str) –

Return type:

datetime

SlyYTDAPI.ytdapi.get_dict_path(d, *keys)[source]#
Parameters:
Return type:

Any

class SlyYTDAPI.ytdapi.Comment(source)[source]#

Bases: object

Parameters:

source (dict[str, Any]) –

property author_name#
replies: list['Comment'] | None#
id: str#
author_display_name: str#
author_channel_id: str#
body: str#
created_at: datetime#
class SlyYTDAPI.ytdapi.Video(source, yt)[source]#

Bases: object

Parameters:
view_count: int#
like_count: int#
comment_count: int#
id: str#
title: str#
description: str#
published_at: datetime#
channel_id: str#
channel_name: str#
tags: list[str]#
is_livestream: bool#
duration: int#
privacy: PrivacyStatus#
Parameters:

short (bool) –

Return type:

str

comments(limit=100)[source]#
Parameters:

limit (int | None) –

Return type:

AsyncTrans[Comment]

await channel()[source]#
Return type:

Channel

class SlyYTDAPI.ytdapi.Playlist(id, yt)[source]#

Bases: object

Parameters:
id: str#
Return type:

str

class SlyYTDAPI.ytdapi.Channel(source, yt)[source]#

Bases: object

Parameters:
property custom_url#
property name#
id: str#
display_name: str#
description: str#
created_at: datetime#
profile_image_url: str | None = None#
at_username: str#
uploads_playlist: Playlist#
view_count: int#
subscriber_count: int#
video_count: int#
Return type:

str

await update()[source]#
videos(limit=None, mine=None)[source]#
Parameters:
  • limit (int | None) –

  • mine (bool | None) –

Return type:

AsyncTrans[Video]

class SlyYTDAPI.ytdapi.YouTubeData(app_or_api_key)[source]#

Bases: WebAPI

Parameters:

app_or_api_key (str | OAuth2 | UrlApiKey) –

base_url: str = 'https://www.googleapis.com/youtube/v3'#
await my_channel(parts=Part.SNIPPET)[source]#
Parameters:

parts (Part) –

Return type:

Channel

await channels(channel_ids, parts)[source]#
Parameters:
Return type:

list[SlyYTDAPI.ytdapi.Channel]

await channel(channel_id, parts=Part.SNIPPET)[source]#
Parameters:
  • channel_id (str) –

  • parts (Part) –

Return type:

Channel

videos(video_ids, parts={<Part.ID: 'id'>, <Part.SNIPPET: 'snippet'>})[source]#
Parameters:
Return type:

AsyncTrans[Video]

await video(id, parts={<Part.ID: 'id'>, <Part.SNIPPET: 'snippet'>})[source]#
Parameters:
Return type:

Video

get_playlist_videos(playlist_id, parts=Part.SNIPPET, limit=None)[source]#
Parameters:
Return type:

AsyncTrans[Video]

search_videos(query=None, channel_id=None, after=None, before=None, mine=None, order=Order.RELEVANCE, safeSearch=SafeSearch.MODERATE, parts=Part.SNIPPET, limit=50)[source]#
Parameters:
Return type:

AsyncTrans[Video]

comments(video_id, query=None, parts={<Part.SNIPPET: 'snippet'>, <Part.REPLIES: 'replies'>}, order=CommentOrder.TIME, limit=None)[source]#
Parameters:
Return type:

AsyncTrans[Comment]