-
Notifications
You must be signed in to change notification settings - Fork 1
/
read_sabr_request.py
34 lines (26 loc) · 963 Bytes
/
read_sabr_request.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# usage: PYTHONPATH="." python utils/read_sabr_request.py /path/to/file
import base64
import sys
from pprint import pprint
import protobug
from yt_dlp_plugins.extractor._ytse.protos import (
VideoPlaybackAbrRequest, unknown_fields,
)
def read_and_print_vpar(file_path):
with open(file_path, 'rb') as f:
file_content = f.read()
try:
vpar = protobug.loads(file_content, VideoPlaybackAbrRequest)
pprint(vpar, width=120)
print(f'video_playback_ustreamer_config b64: {base64.b64encode(vpar.video_playback_ustreamer_config).decode()}')
uf = list(unknown_fields(vpar))
if uf:
print(f'Unknown Fields: {uf}')
except Exception as e:
print(f'Error loading VideoPlaybackAbrRequest: {e}')
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: read_sabr_request.py /path/to/file")
sys.exit(1)
file_path = sys.argv[1]
read_and_print_vpar(file_path)