Skip to content

Commit

Permalink
Fix reddit playback
Browse files Browse the repository at this point in the history
Fixes #21
  • Loading branch information
duncte123 committed Nov 26, 2023
1 parent eb8493d commit 668d977
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public String getPlaybackUrl() {
}

static String getPlaybackUrl(String id) {
return "https://v.redd.it/" + id + "/DASH_audio.mp4?source=fallback";
return "https://v.redd.it/" + id + "/DASH_AUDIO_128.mp4";
}

@Override
Expand Down
35 changes: 35 additions & 0 deletions source-managers/src/test/java/RedditTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2022 Duncan "duncte123" Sterken
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import com.dunctebot.sourcemanagers.reddit.RedditAudioSourceManager;
import com.dunctebot.sourcemanagers.reddit.RedditAudioTrack;
import com.sedmelluq.discord.lavaplayer.track.AudioReference;

public class RedditTest {
public static void main(String[] args) {
final var id1 = "https://www.reddit.com/r/funnyvideos/comments/15cvyaj/cant_find_this_woman_but_she_is_smart/";
final var mngr = new RedditAudioSourceManager();
final var res1 = mngr.loadItem(null, new AudioReference(id1, ""));

System.out.println(res1);

if (res1 instanceof RedditAudioTrack) {
final var track = (RedditAudioTrack) res1;

System.out.println(track.getPlaybackUrl());
}
}
}

0 comments on commit 668d977

Please sign in to comment.