mirror of
https://cdm-project.com/Download-Tools/udemy-downloader.git
synced 2025-04-29 19:34:25 +02:00
update protobuf
This commit is contained in:
parent
8ab48230ed
commit
875d888503
@ -2,7 +2,7 @@ mpegdash
|
|||||||
tqdm
|
tqdm
|
||||||
requests
|
requests
|
||||||
python-dotenv
|
python-dotenv
|
||||||
protobuf==3.20.0
|
protobuf
|
||||||
webvtt-py
|
webvtt-py
|
||||||
pysrt
|
pysrt
|
||||||
m3u8
|
m3u8
|
||||||
|
10
utils.py
10
utils.py
@ -1,9 +1,11 @@
|
|||||||
import mp4parse
|
|
||||||
import codecs
|
|
||||||
import widevine_pssh_pb2
|
|
||||||
import base64
|
import base64
|
||||||
|
import codecs
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import mp4parse
|
||||||
|
import widevine_pssh_data_pb2
|
||||||
|
|
||||||
|
|
||||||
def extract_kid(mp4_file):
|
def extract_kid(mp4_file):
|
||||||
"""
|
"""
|
||||||
Parameters
|
Parameters
|
||||||
@ -26,7 +28,7 @@ def extract_kid(mp4_file):
|
|||||||
pssh_box = next(x for x in box.pssh if x.system_id == "edef8ba979d64acea3c827dcd51d21ed")
|
pssh_box = next(x for x in box.pssh if x.system_id == "edef8ba979d64acea3c827dcd51d21ed")
|
||||||
hex = codecs.decode(pssh_box.payload, "hex")
|
hex = codecs.decode(pssh_box.payload, "hex")
|
||||||
|
|
||||||
pssh = widevine_pssh_pb2.WidevinePsshData()
|
pssh = widevine_pssh_data_pb2.WidevinePsshData()
|
||||||
pssh.ParseFromString(hex)
|
pssh.ParseFromString(hex)
|
||||||
content_id = base64.b16encode(pssh.content_id)
|
content_id = base64.b16encode(pssh.content_id)
|
||||||
return content_id.decode("utf-8")
|
return content_id.decode("utf-8")
|
||||||
|
56
widevine_pssh_data.proto
Normal file
56
widevine_pssh_data.proto
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// Copyright 2016 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file or at
|
||||||
|
// https://developers.google.com/open-source/licenses/bsd
|
||||||
|
//
|
||||||
|
// This file defines Widevine Pssh Data proto format.
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
package shaka.media;
|
||||||
|
|
||||||
|
message WidevinePsshData {
|
||||||
|
enum Algorithm {
|
||||||
|
UNENCRYPTED = 0;
|
||||||
|
AESCTR = 1;
|
||||||
|
};
|
||||||
|
optional Algorithm algorithm = 1;
|
||||||
|
repeated bytes key_id = 2;
|
||||||
|
|
||||||
|
// Content provider name.
|
||||||
|
optional string provider = 3;
|
||||||
|
|
||||||
|
// A content identifier, specified by content provider.
|
||||||
|
optional bytes content_id = 4;
|
||||||
|
|
||||||
|
// The name of a registered policy to be used for this asset.
|
||||||
|
optional string policy = 6;
|
||||||
|
|
||||||
|
// Crypto period index, for media using key rotation.
|
||||||
|
optional uint32 crypto_period_index = 7;
|
||||||
|
|
||||||
|
// Optional protected context for group content. The grouped_license is a
|
||||||
|
// serialized SignedMessage.
|
||||||
|
optional bytes grouped_license = 8;
|
||||||
|
|
||||||
|
// Protection scheme identifying the encryption algorithm. Represented as one
|
||||||
|
// of the following 4CC values: 'cenc' (AES-CTR), 'cbc1' (AES-CBC),
|
||||||
|
// 'cens' (AES-CTR subsample), 'cbcs' (AES-CBC subsample).
|
||||||
|
optional uint32 protection_scheme = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Derived from WidevinePsshData. The JSON format of this proto is used in
|
||||||
|
// Widevine HLS DRM signaling v1.
|
||||||
|
// We cannot build JSON from WidevinePsshData as |key_id| is required to be in
|
||||||
|
// hex format, while |bytes| type is translated to base64 by JSON formatter, so
|
||||||
|
// we have to use |string| type and do hex conversion in the code.
|
||||||
|
message WidevineHeader {
|
||||||
|
repeated string key_ids = 2;
|
||||||
|
|
||||||
|
// Content provider name.
|
||||||
|
optional string provider = 3;
|
||||||
|
|
||||||
|
// A content identifier, specified by content provider.
|
||||||
|
optional bytes content_id = 4;
|
||||||
|
}
|
29
widevine_pssh_data_pb2.py
Normal file
29
widevine_pssh_data_pb2.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
|
# source: widevine_pssh_data.proto
|
||||||
|
"""Generated protocol buffer code."""
|
||||||
|
from google.protobuf import descriptor as _descriptor
|
||||||
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||||
|
from google.protobuf import symbol_database as _symbol_database
|
||||||
|
from google.protobuf.internal import builder as _builder
|
||||||
|
# @@protoc_insertion_point(imports)
|
||||||
|
|
||||||
|
_sym_db = _symbol_database.Default()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18widevine_pssh_data.proto\x12\x0bshaka.media\"\x8f\x02\n\x10WidevinePsshData\x12:\n\talgorithm\x18\x01 \x01(\x0e\x32\'.shaka.media.WidevinePsshData.Algorithm\x12\x0e\n\x06key_id\x18\x02 \x03(\x0c\x12\x10\n\x08provider\x18\x03 \x01(\t\x12\x12\n\ncontent_id\x18\x04 \x01(\x0c\x12\x0e\n\x06policy\x18\x06 \x01(\t\x12\x1b\n\x13\x63rypto_period_index\x18\x07 \x01(\r\x12\x17\n\x0fgrouped_license\x18\x08 \x01(\x0c\x12\x19\n\x11protection_scheme\x18\t \x01(\r\"(\n\tAlgorithm\x12\x0f\n\x0bUNENCRYPTED\x10\x00\x12\n\n\x06\x41\x45SCTR\x10\x01\"G\n\x0eWidevineHeader\x12\x0f\n\x07key_ids\x18\x02 \x03(\t\x12\x10\n\x08provider\x18\x03 \x01(\t\x12\x12\n\ncontent_id\x18\x04 \x01(\x0c')
|
||||||
|
|
||||||
|
_globals = globals()
|
||||||
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||||
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'widevine_pssh_data_pb2', _globals)
|
||||||
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||||
|
DESCRIPTOR._options = None
|
||||||
|
_globals['_WIDEVINEPSSHDATA']._serialized_start=42
|
||||||
|
_globals['_WIDEVINEPSSHDATA']._serialized_end=313
|
||||||
|
_globals['_WIDEVINEPSSHDATA_ALGORITHM']._serialized_start=273
|
||||||
|
_globals['_WIDEVINEPSSHDATA_ALGORITHM']._serialized_end=313
|
||||||
|
_globals['_WIDEVINEHEADER']._serialized_start=315
|
||||||
|
_globals['_WIDEVINEHEADER']._serialized_end=386
|
||||||
|
# @@protoc_insertion_point(module_scope)
|
@ -1,141 +0,0 @@
|
|||||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
||||||
# source: widevine_pssh.proto
|
|
||||||
|
|
||||||
import sys
|
|
||||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
|
||||||
from google.protobuf import descriptor as _descriptor
|
|
||||||
from google.protobuf import message as _message
|
|
||||||
from google.protobuf import reflection as _reflection
|
|
||||||
from google.protobuf import symbol_database as _symbol_database
|
|
||||||
from google.protobuf import descriptor_pb2
|
|
||||||
# @@protoc_insertion_point(imports)
|
|
||||||
|
|
||||||
_sym_db = _symbol_database.Default()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTOR = _descriptor.FileDescriptor(
|
|
||||||
name='widevine_pssh.proto',
|
|
||||||
package='',
|
|
||||||
serialized_pb=_b('\n\x13widevine_pssh.proto\"\xfc\x01\n\x10WidevinePsshData\x12.\n\talgorithm\x18\x01 \x01(\x0e\x32\x1b.WidevinePsshData.Algorithm\x12\x0e\n\x06key_id\x18\x02 \x03(\x0c\x12\x10\n\x08provider\x18\x03 \x01(\t\x12\x12\n\ncontent_id\x18\x04 \x01(\x0c\x12\x12\n\ntrack_type\x18\x05 \x01(\t\x12\x0e\n\x06policy\x18\x06 \x01(\t\x12\x1b\n\x13\x63rypto_period_index\x18\x07 \x01(\r\x12\x17\n\x0fgrouped_license\x18\x08 \x01(\x0c\"(\n\tAlgorithm\x12\x0f\n\x0bUNENCRYPTED\x10\x00\x12\n\n\x06\x41\x45SCTR\x10\x01')
|
|
||||||
)
|
|
||||||
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_WIDEVINEPSSHDATA_ALGORITHM = _descriptor.EnumDescriptor(
|
|
||||||
name='Algorithm',
|
|
||||||
full_name='WidevinePsshData.Algorithm',
|
|
||||||
filename=None,
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
values=[
|
|
||||||
_descriptor.EnumValueDescriptor(
|
|
||||||
name='UNENCRYPTED', index=0, number=0,
|
|
||||||
options=None,
|
|
||||||
type=None),
|
|
||||||
_descriptor.EnumValueDescriptor(
|
|
||||||
name='AESCTR', index=1, number=1,
|
|
||||||
options=None,
|
|
||||||
type=None),
|
|
||||||
],
|
|
||||||
containing_type=None,
|
|
||||||
options=None,
|
|
||||||
serialized_start=236,
|
|
||||||
serialized_end=276,
|
|
||||||
)
|
|
||||||
_sym_db.RegisterEnumDescriptor(_WIDEVINEPSSHDATA_ALGORITHM)
|
|
||||||
|
|
||||||
|
|
||||||
_WIDEVINEPSSHDATA = _descriptor.Descriptor(
|
|
||||||
name='WidevinePsshData',
|
|
||||||
full_name='WidevinePsshData',
|
|
||||||
filename=None,
|
|
||||||
file=DESCRIPTOR,
|
|
||||||
containing_type=None,
|
|
||||||
fields=[
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='algorithm', full_name='WidevinePsshData.algorithm', index=0,
|
|
||||||
number=1, type=14, cpp_type=8, label=1,
|
|
||||||
has_default_value=False, default_value=0,
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='key_id', full_name='WidevinePsshData.key_id', index=1,
|
|
||||||
number=2, type=12, cpp_type=9, label=3,
|
|
||||||
has_default_value=False, default_value=[],
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='provider', full_name='WidevinePsshData.provider', index=2,
|
|
||||||
number=3, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='content_id', full_name='WidevinePsshData.content_id', index=3,
|
|
||||||
number=4, type=12, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b(""),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='track_type', full_name='WidevinePsshData.track_type', index=4,
|
|
||||||
number=5, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='policy', full_name='WidevinePsshData.policy', index=5,
|
|
||||||
number=6, type=9, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='crypto_period_index', full_name='WidevinePsshData.crypto_period_index', index=6,
|
|
||||||
number=7, type=13, cpp_type=3, label=1,
|
|
||||||
has_default_value=False, default_value=0,
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
_descriptor.FieldDescriptor(
|
|
||||||
name='grouped_license', full_name='WidevinePsshData.grouped_license', index=7,
|
|
||||||
number=8, type=12, cpp_type=9, label=1,
|
|
||||||
has_default_value=False, default_value=_b(""),
|
|
||||||
message_type=None, enum_type=None, containing_type=None,
|
|
||||||
is_extension=False, extension_scope=None,
|
|
||||||
options=None),
|
|
||||||
],
|
|
||||||
extensions=[
|
|
||||||
],
|
|
||||||
nested_types=[],
|
|
||||||
enum_types=[
|
|
||||||
_WIDEVINEPSSHDATA_ALGORITHM,
|
|
||||||
],
|
|
||||||
options=None,
|
|
||||||
is_extendable=False,
|
|
||||||
extension_ranges=[],
|
|
||||||
oneofs=[
|
|
||||||
],
|
|
||||||
serialized_start=24,
|
|
||||||
serialized_end=276,
|
|
||||||
)
|
|
||||||
|
|
||||||
_WIDEVINEPSSHDATA.fields_by_name['algorithm'].enum_type = _WIDEVINEPSSHDATA_ALGORITHM
|
|
||||||
_WIDEVINEPSSHDATA_ALGORITHM.containing_type = _WIDEVINEPSSHDATA
|
|
||||||
DESCRIPTOR.message_types_by_name['WidevinePsshData'] = _WIDEVINEPSSHDATA
|
|
||||||
|
|
||||||
WidevinePsshData = _reflection.GeneratedProtocolMessageType('WidevinePsshData', (_message.Message,), dict(
|
|
||||||
DESCRIPTOR = _WIDEVINEPSSHDATA,
|
|
||||||
__module__ = 'widevine_pssh_pb2'
|
|
||||||
# @@protoc_insertion_point(class_scope:WidevinePsshData)
|
|
||||||
))
|
|
||||||
_sym_db.RegisterMessage(WidevinePsshData)
|
|
||||||
|
|
||||||
|
|
||||||
# @@protoc_insertion_point(module_scope)
|
|
Loading…
x
Reference in New Issue
Block a user