2024-03-23 09:50:42 +00:00
|
|
|
from dataclasses import dataclass
|
2024-08-24 18:16:22 +00:00
|
|
|
from typing import Any, List, Literal, Mapping, Optional, TypedDict
|
2024-03-23 09:50:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class DownloadOptions:
|
2024-04-23 15:14:27 +00:00
|
|
|
auth_token: Optional[str]
|
|
|
|
chapter: Optional[int]
|
2024-03-29 07:24:45 +00:00
|
|
|
concat: bool
|
2024-03-23 09:50:42 +00:00
|
|
|
dry_run: bool
|
2024-04-23 15:14:27 +00:00
|
|
|
end: Optional[int]
|
2024-03-23 09:50:42 +00:00
|
|
|
format: str
|
|
|
|
keep: bool
|
|
|
|
no_join: bool
|
|
|
|
overwrite: bool
|
|
|
|
output: str
|
2024-04-23 15:14:27 +00:00
|
|
|
quality: Optional[str]
|
|
|
|
rate_limit: Optional[int]
|
|
|
|
start: Optional[int]
|
2024-03-23 09:50:42 +00:00
|
|
|
max_workers: int
|
2024-03-30 06:32:12 +00:00
|
|
|
|
|
|
|
|
2024-08-24 18:16:22 +00:00
|
|
|
ClipsPeriod = Literal["last_day", "last_week", "last_month", "all_time"]
|
|
|
|
VideosSort = Literal["views", "time"]
|
|
|
|
VideosType = Literal["archive", "highlight", "upload"]
|
|
|
|
|
|
|
|
|
|
|
|
class AccessToken(TypedDict):
|
|
|
|
signature: str
|
|
|
|
value: str
|
|
|
|
|
|
|
|
|
|
|
|
class User(TypedDict):
|
|
|
|
login: str
|
|
|
|
displayName: str
|
|
|
|
|
|
|
|
|
|
|
|
class Game(TypedDict):
|
|
|
|
id: str
|
|
|
|
name: str
|
|
|
|
|
|
|
|
|
|
|
|
class VideoQuality(TypedDict):
|
|
|
|
frameRate: str
|
|
|
|
quality: str
|
|
|
|
sourceURL: str
|
|
|
|
|
|
|
|
|
|
|
|
class ClipAccessToken(TypedDict):
|
|
|
|
id: str
|
|
|
|
playbackAccessToken: AccessToken
|
|
|
|
videoQualities: List[VideoQuality]
|
|
|
|
|
|
|
|
|
|
|
|
class Clip(TypedDict):
|
|
|
|
id: str
|
|
|
|
slug: str
|
|
|
|
title: str
|
|
|
|
createdAt: str
|
|
|
|
viewCount: int
|
|
|
|
durationSeconds: int
|
|
|
|
url: str
|
|
|
|
videoQualities: List[VideoQuality]
|
|
|
|
game: Game
|
|
|
|
broadcaster: User
|
|
|
|
|
|
|
|
|
|
|
|
class Video(TypedDict):
|
|
|
|
id: str
|
|
|
|
title: str
|
|
|
|
description: str
|
|
|
|
publishedAt: str
|
|
|
|
broadcastType: str
|
|
|
|
lengthSeconds: int
|
|
|
|
game: Game
|
|
|
|
creator: User
|
|
|
|
|
|
|
|
|
|
|
|
class Chapter(TypedDict):
|
|
|
|
id: str
|
|
|
|
durationMilliseconds: int
|
|
|
|
positionMilliseconds: int
|
|
|
|
type: str
|
|
|
|
description: str
|
|
|
|
subDescription: str
|
|
|
|
thumbnailURL: str
|
|
|
|
game: Game
|
|
|
|
|
|
|
|
|
2024-03-30 06:32:12 +00:00
|
|
|
# Type for annotating decoded JSON
|
|
|
|
# TODO: make data classes for common structs
|
2024-04-23 16:09:30 +00:00
|
|
|
Data = Mapping[str, Any]
|