Skip to content

Commit

Permalink
Get youtubetokens on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sartharon committed Aug 17, 2023
1 parent 157498c commit 1083808
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/com/jagrosh/jmusicbot/audio/PlayerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ public void init()
ExtendedHttpConfigurable httpConfiguration = source(YoutubeAudioSourceManager.class).getHttpConfiguration();
YoutubeHttpContextFilter youtubeHttpContextFilter = new YoutubeHttpContextFilter();
YoutubeAccessTokenTracker accessTokenTracker = new YoutubeAccessTokenTracker(httpInterfaceManager, bot.getConfig().getYoutubeEmail(), bot.getConfig().getYoutubePwd());
accessTokenTracker.updateMasterToken();
while (accessTokenTracker.getMasterToken() == null) {
//Busy waiting for the master token
}
while (accessTokenTracker.getAccessToken() == null) {
//Busy waiting for the access token
}
while (accessTokenTracker.getVisitorId() == null) {
//Busy waiting for the visitor token
}
youtubeHttpContextFilter.setTokenTracker(accessTokenTracker);
httpConfiguration.setHttpContextFilter(youtubeHttpContextFilter);
}
Expand Down

0 comments on commit 1083808

Please sign in to comment.