-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protos) Add SabrContextUpdate, TimelineContext (#5)
Appears to be used for SSAP
- Loading branch information
Showing
7 changed files
with
142 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
yt_dlp_plugins/extractor/_ytse/protos/_sabr_context_sending_policy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import protobug | ||
|
||
|
||
@protobug.message | ||
class SabrContextSendingPolicy: | ||
# These contain the SabrContextUpdate.type values | ||
# They are used to alter if a SabrContextUpdate is sent or not? | ||
|
||
# Start sending the SabrContextUpdates of this type | ||
start_policy: list[protobug.Int32] = protobug.field(1, default_factory=list) | ||
|
||
# Stop sending the SabrContextUpdates of this type | ||
stop_policy: list[protobug.Int32] = protobug.field(2, default_factory=list) | ||
|
||
# Stop and discard the SabrContextUpdates of this type | ||
# When type of 3, something is cleared from video data (related to SSAP and TIMELINE_CONTEXT) | ||
discard_policy: list[protobug.Int32] = protobug.field(3, default_factory=list) |
37 changes: 37 additions & 0 deletions
37
yt_dlp_plugins/extractor/_ytse/protos/_sabr_context_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import typing | ||
import protobug | ||
|
||
|
||
# @protobug.message | ||
# class ExampleTypeTwoContextUpdate: | ||
# # At least appears to match BufferedRange pb... | ||
# buffered_ranges: list[BufferedRange] = protobug.field(1, default_factory=list) | ||
|
||
# May be provided in: | ||
# - mediaCommonConfig in Innertube config | ||
# - SABR_CONTEXT_UPDATE | ||
# - TIMELINE_CONTEXT | ||
|
||
@protobug.message | ||
class SabrContextUpdate: | ||
|
||
class SabrContextScope(protobug.Enum): | ||
SABR_CONTEXT_SCOPE_UNKNOWN = 0 | ||
SABR_CONTEXT_SCOPE_PLAYBACK = 1 | ||
SABR_CONTEXT_SCOPE_REQUEST = 2 | ||
SABR_CONTEXT_SCOPE_WATCH_ENDPOINT = 3 | ||
SABR_CONTEXT_SCOPE_CONTENT_ADS = 4 | ||
|
||
class SabrContextWritePolicy(protobug.Enum): | ||
# Whether to override existing sabr context updates? | ||
SABR_CONTEXT_WRITE_POLICY_UNSPECIFIED = 0 | ||
SABR_CONTEXT_WRITE_POLICY_OVERWRITE = 1 | ||
SABR_CONTEXT_WRITE_POLICY_KEEP_EXISTING = 2 | ||
|
||
type: typing.Optional[protobug.Int32] = protobug.field(1, default=None) # seen = 2 | ||
scope: typing.Optional[SabrContextScope] = protobug.field(2, default=None) # seen = 2 (SABR_CONTEXT_SCOPE_REQUEST?) | ||
|
||
# note: may be base64 encoded | ||
value: typing.Optional[protobug.Bytes] = protobug.field(3, default=None) | ||
send_by_default: typing.Optional[protobug.Bool] = protobug.field(4, default=None) # seen = True | ||
write_policy: typing.Optional[SabrContextWritePolicy] = protobug.field(5, default=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
yt_dlp_plugins/extractor/_ytse/protos/_timeline_context.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import typing | ||
import protobug | ||
from ._sabr_context_update import SabrContextUpdate | ||
|
||
|
||
@protobug.message | ||
class rkH: | ||
video_id: typing.Optional[protobug.String] = protobug.field(1, default=None) # videoId | ||
pst: typing.Optional[protobug.Int32] = protobug.field(2, default=None) # time - playback start time? | ||
lst: typing.Optional[protobug.Int32] = protobug.field(3, default=None) # lst | ||
ld: typing.Optional[protobug.Int32] = protobug.field(4, default=None) # duration | ||
ls: typing.Optional[protobug.Int32] = protobug.field(5, default=None) # scale for ld | ||
ps: typing.Optional[protobug.Int32] = protobug.field(6, default=None) # scale for pst | ||
|
||
|
||
|
||
@protobug.message | ||
class i8V: | ||
L4: typing.Optional[protobug.Int32] = protobug.field(1, default=None) # nonv | ||
|
||
|
||
@protobug.message | ||
class Clip: | ||
clip_id: typing.Optional[protobug.String] = protobug.field(1, default=None) | ||
T7: typing.Optional[rkH] = protobug.field(2, default=None) | ||
h2: typing.Optional[i8V] = protobug.field(3, default=None) | ||
|
||
|
||
@protobug.message | ||
class Timeline: | ||
clip: list[Clip] = protobug.field(1, default_factory=list) | ||
version: typing.Optional[protobug.String] = protobug.field(2, default=None) | ||
|
||
|
||
# Looks like this may be used for SSAP to update the visible timeline + provide a SABR context override to switch to the ad? | ||
@protobug.message | ||
class TimelineContext: | ||
timeline: typing.Optional[Timeline] = protobug.field(1, default=None) | ||
sabr_context_update: typing.Optional[SabrContextUpdate] = protobug.field(2, default=None) |