mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-19 23:00:36 -04:00
YoutubeAPI: Add the resolve_url() endpoint handler
This commit is contained in:
parent
75e196adcc
commit
79a638e059
1 changed files with 34 additions and 0 deletions
|
@ -253,6 +253,40 @@ module YoutubeAPI
|
||||||
return self._post_json("/youtubei/v1/player", data, client_config)
|
return self._post_json("/youtubei/v1/player", data, client_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
####################################################################
|
||||||
|
# resolve_url(url)
|
||||||
|
#
|
||||||
|
# Requests the youtubei/v1/navigation/resolve_url endpoint with the
|
||||||
|
# required headers and POST data in order to get a JSON reply.
|
||||||
|
#
|
||||||
|
# Output:
|
||||||
|
#
|
||||||
|
# ```
|
||||||
|
# # Valid channel "brand URL" gives the related UCID and browse ID
|
||||||
|
# channel_a = YoutubeAPI.resolve_url("https://youtube.com/c/google")
|
||||||
|
# channel_a # => {
|
||||||
|
# "endpoint": {
|
||||||
|
# "browseEndpoint": {
|
||||||
|
# "params": "EgC4AQA%3D",
|
||||||
|
# "browseId":"UCK8sQmJBp8GCxrOtXWBpyEA"
|
||||||
|
# },
|
||||||
|
# ...
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# # Invalid URL returns throws an InfoException
|
||||||
|
# channel_b = YoutubeAPI.resolve_url("https://youtube.com/c/invalid")
|
||||||
|
# ```
|
||||||
|
#
|
||||||
|
def resolve_url(url : String)
|
||||||
|
data = {
|
||||||
|
"context" => self.make_context(nil),
|
||||||
|
"url" => url,
|
||||||
|
}
|
||||||
|
|
||||||
|
return self._post_json("/youtubei/v1/navigation/resolve_url", data)
|
||||||
|
end
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# search(search_query, params, client_config?)
|
# search(search_query, params, client_config?)
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue