mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-16 01:48:51 +00:00
Captions: Add ability to use Innertube's transcripts API (#4001)
This commit is contained in:
@@ -557,6 +557,30 @@ module YoutubeAPI
|
||||
return self._post_json("/youtubei/v1/search", data, client_config)
|
||||
end
|
||||
|
||||
####################################################################
|
||||
# get_transcript(params, client_config?)
|
||||
#
|
||||
# Requests the youtubei/v1/get_transcript endpoint with the required headers
|
||||
# and POST data in order to get a JSON reply.
|
||||
#
|
||||
# The requested data is a specially encoded protobuf string that denotes the specific language requested.
|
||||
#
|
||||
# An optional ClientConfig parameter can be passed, too (see
|
||||
# `struct ClientConfig` above for more details).
|
||||
#
|
||||
|
||||
def get_transcript(
|
||||
params : String,
|
||||
client_config : ClientConfig | Nil = nil
|
||||
) : Hash(String, JSON::Any)
|
||||
data = {
|
||||
"context" => self.make_context(client_config),
|
||||
"params" => params,
|
||||
}
|
||||
|
||||
return self._post_json("/youtubei/v1/get_transcript", data, client_config)
|
||||
end
|
||||
|
||||
####################################################################
|
||||
# _post_json(endpoint, data, client_config?)
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user