SlyYTAAPI.analytics#

Functions

makeFilters(filters)

Classes

ColumnHeader

From https://developers.google.com/youtube/analytics/v2/reference/reports/query

Dimensions(value[, names, module, qualname, ...])

From https://developers.google.com/youtube/analytics/dimensions

Metrics(value[, names, module, qualname, ...])

From https://developers.google.com/youtube/reporting#metrics

QueryResult(kind, columnHeaders, rows)

Table of data returned by YouTube Analytics API.

Scope()

YouTubeAnalytics(channel_id, auth_or_app[, ...])

SlyYTAAPI.analytics.makeFilters(filters)[source]#
Parameters:

filters (dict[str, Any]) –

Return type:

str

class SlyYTAAPI.analytics.Dimensions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

From https://developers.google.com/youtube/analytics/dimensions

Day = 'day'#
Month = 'month'#
Country = 'country'#
Video = 'video'#
class SlyYTAAPI.analytics.Metrics(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

From https://developers.google.com/youtube/reporting#metrics

Views = 'views'#
Likes = 'likes'#
Dislikes = 'dislikes'#
WatchTime = 'estimatedMinutesWatched'#
SubsGained = 'subscribersGained'#
SubsLost = 'subscribersLost'#
class SlyYTAAPI.analytics.ColumnHeader[source]#

Bases: TypedDict

From https://developers.google.com/youtube/analytics/v2/reference/reports/query

name: str#
columnType: Union[Literal['DIMENSION'], Literal['METRIC']]#
dataType: str#
class SlyYTAAPI.analytics.QueryResult(kind, columnHeaders, rows)[source]#

Bases: object

Table of data returned by YouTube Analytics API. From https://developers.google.com/youtube/analytics/v2/reference/reports/query

Parameters:
kind: str#
columnHeaders: list[SlyYTAAPI.analytics.ColumnHeader]#
rows: list[list[int | str | float | bool | None]]#
saveJSON(path)[source]#
Parameters:

path (str) –

saveCSV(path)[source]#
Parameters:

path (str) –

class SlyYTAAPI.analytics.Scope[source]#

Bases: object

Analytics = 'https://www.googleapis.com/auth/yt-analytics.readonly'#
Monetary = 'https://www.googleapis.com/auth/yt-analytics-monetary.readonly'#
YouTube = 'https://www.googleapis.com/auth/youtube'#
YouTubePartner = 'https://www.googleapis.com/auth/youtubepartner'#
YouTubeReadOnly = 'https://www.googleapis.com/auth/youtube.readonly'#
class SlyYTAAPI.analytics.YouTubeAnalytics(channel_id, auth_or_app, user=None, _scopes=None)[source]#

Bases: WebAPI

Parameters:
base_url: str = 'https://youtubeanalytics.googleapis.com/v2'#
DEFAULT_SCOPES = 'https://www.googleapis.com/auth/yt-analytics.readonly https://www.googleapis.com/auth/yt-analytics-monetary.readonly https://www.googleapis.com/auth/youtube.readonly'#
channel_id: str#
__await__()[source]#
await video(video_id, since, metrics, dims, end_date=None)[source]#
Parameters:
Return type:

QueryResult

await query(since, metrics, dims, end_date=None, filters=None)[source]#
Parameters:
Return type:

QueryResult