Skip to content

Commit

Permalink
Youtube api improvements (#2277)
Browse files Browse the repository at this point in the history
* Put youtube API functions under the YoutubeAPI namespace

* Implement the following endpoints:
  - `next`
  - `player`
  - `resolve_url`

* Allow a ClientConfig to be passed to YoutubeAPI endpoint handlers.

* Add constants for many new clients

* Fix documentation of YoutubeAPI.browse(): Comments and search
  result aren't returned by the browse() endpoint but by the next()
  and search() endpoints, respectively.

* Accept gzip compressed data, to help save on bandwidth

* Add debug/trace logging

* Other minor fixes
  • Loading branch information
SamantazFox authored Aug 3, 2021
1 parent c76bd7b commit 5b020e8
Show file tree
Hide file tree
Showing 6 changed files with 439 additions and 107 deletions.
2 changes: 1 addition & 1 deletion src/invidious/channels/playlists.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def fetch_channel_playlists(ucid, author, continuation, sort_by)
if continuation
response_json = request_youtube_api_browse(continuation)
response_json = YoutubeAPI.browse(continuation)
continuationItems = response_json["onResponseReceivedActions"]?
.try &.[0]["appendContinuationItemsAction"]["continuationItems"]

Expand Down
2 changes: 1 addition & 1 deletion src/invidious/channels/videos.cr
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_channel_videos_response(ucid, page = 1, auto_generated = nil, sort_by =
continuation = produce_channel_videos_continuation(ucid, page,
auto_generated: auto_generated, sort_by: sort_by, v2: true)

return request_youtube_api_browse(continuation)
return YoutubeAPI.browse(continuation)
end

def get_60_videos(ucid, author, page, auto_generated, sort_by = "newest")
Expand Down
Loading

0 comments on commit 5b020e8

Please sign in to comment.