Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
coletdjnz committed Feb 18, 2025
1 parent 6b1fa6c commit 80d7523
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
7 changes: 3 additions & 4 deletions yt_dlp_plugins/extractor/_ytse/protos/_sabr_context_update.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import typing
import protobug
from ._buffered_range import BufferedRange


# @protobug.message
# class ContextUpdate:
# class ExampleTypeTwoContextUpdate:
# # At least appears to match BufferedRange pb...
# buffered_ranges: list[BufferedRange] = protobug.field(1, default_factory=list)

# May be used in:
# May be provided in:
# - mediaCommonConfig in Innertube config
# - SABR_CONTEXT_UPDATE
# - TIMELINE_CONTEXT
Expand All @@ -32,7 +31,7 @@ class SabrContextWritePolicy(protobug.Enum):
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?)

# May be base64 encoded, but not always
# 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)
10 changes: 5 additions & 5 deletions yt_dlp_plugins/extractor/_ytse/protos/_streamer_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ClientInfo:


@protobug.message
class SabrContext:
class ContextUpdate:
# Type and Value from a SabrContextUpdate
type: typing.Optional[protobug.Int32] = protobug.field(1, default=None)
value: typing.Optional[protobug.Bytes] = protobug.field(2, default=None)
Expand All @@ -69,9 +69,9 @@ class StreamerContext:
po_token: typing.Optional[protobug.Bytes] = protobug.field(2, default=None)
playback_cookie: typing.Optional[protobug.Bytes] = protobug.field(3, default=None)
gp: typing.Optional[protobug.Bytes] = protobug.field(4, default=None)
# referred to as "stmctxt". Seems to be the SABR context updates (ad updates) to apply?
sabr_contexts: list[SabrContext] = protobug.field(5, default_factory=list)
# referred to as "unsntctxt". Is the type in the SABR Context update that was not sent (e.g. sendByDefault is False)
unsent_sabr_contexts: list[protobug.Int32] = protobug.field(6, default_factory=list)
# referred to as "stmctxt". Seems to be the SABR context updates to apply?
context_updates: list[ContextUpdate] = protobug.field(5, default_factory=list)
# referred to as "unsntctxt". Is the type in the SABR Context update that was not sent (e.g. sendByDefault is False, or excluded by a sending policy)
unsent_context_updates: list[protobug.Int32] = protobug.field(6, default_factory=list)
field7: typing.Optional[protobug.String] = protobug.field(7, default=None)
field8: typing.Optional[Gqa] = protobug.field(8, default=None)
5 changes: 3 additions & 2 deletions yt_dlp_plugins/extractor/_ytse/protos/_timeline_context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import typing
import protobug
from . import SabrContextUpdate
from ._sabr_context_update import SabrContextUpdate


@protobug.message
Expand Down Expand Up @@ -32,7 +32,8 @@ class Timeline:
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) # may be a list, todo: confirm
timeline: typing.Optional[Timeline] = protobug.field(1, default=None)
sabr_context_update: typing.Optional[SabrContextUpdate] = protobug.field(2, default=None)

0 comments on commit 80d7523

Please sign in to comment.