lavalink-devs/youtube-source

This video is unavailable

Closed this issue · 10 comments

com.sedmelluq.discord.lavaplayer.tools.FriendlyException: This video is unavailable
        at dev.lavalink.youtube.clients.skeleton.Client.getPlayabilityStatus(Client.java:60)
        at dev.lavalink.youtube.clients.skeleton.NonMusicClient.loadTrackInfoFromInnertube(NonMusicClient.java:98)
        at dev.lavalink.youtube.clients.skeleton.StreamingNonMusicClient.loadFormats(StreamingNonMusicClient.java:35)
        at dev.lavalink.youtube.track.YoutubeAudioTrack.loadBestFormatWithUrl(YoutubeAudioTrack.java:183)
        at dev.lavalink.youtube.track.YoutubeAudioTrack.processWithClient(YoutubeAudioTrack.java:109)
        at dev.lavalink.youtube.track.YoutubeAudioTrack.process(YoutubeAudioTrack.java:71)
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:101)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$2(DefaultAudioPlayerManager.java:330)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1623)

Hello, is there a way to bypass this error? I get it when using my music bot on my server - when running it locally it works without any problems.
Hope that there's a solution for it...

Use IP rotation.

Oh okay, I "only" found

AbstractRouterPlanner routePlanner = new ...
YoutubeIpRotatorSetup rotator = new YoutubeIpRotatorSetup(routePlanner);

rotator.forConfiguration(youtube.getHttpInterfaceManager(), false)
    .withMainDelegateFilter(null) // This is important, otherwise you may get NullPointerExceptions.
    .setup();

for that... sadly I never worked with routePlanners, so I dont know how to use them - do you maybe have an example or a documentation for it which explains how to use it?

https://github.com/lavalink-devs/lavaplayer/tree/main/extensions/youtube-rotator/src/main/java/com/sedmelluq/lava/extensions/youtuberotator/planner

Pick a route planner from this list, instantiate it and pass it to the YoutubeIpRotatorSetup class.
I personally would go for RotatingNanoIp

It doesnt know YoutubeIpRotatorSetup for me for some reason - have I to add something to my gradle?

dev.arbjerg:lavaplayer-ext-youtube-rotator:<LAVAPLAYER-VERSION>
replace <LAVAPLAYER-VERSION> with the version of Lavaplayer that you are using, e.g. 1.5.4, 2.1.2, ...

thanks

Is there an example for using RotatingNanoIp

So I tried:

YoutubeAudioSourceManager youtubeProvider = new YoutubeAudioSourceManager(true, new MusicWithThumbnail(), new WebWithThumbnail(), new AndroidWithThumbnail());

RotatingNanoIpRoutePlanner routePlanner = new RotatingNanoIpRoutePlanner(Collections.singletonList(
        new Ipv6Block(Utils.getIPAddress() + "::/64")
));
YoutubeIpRotatorSetup rotator = new YoutubeIpRotatorSetup(routePlanner);
rotator.forConfiguration(youtubeProvider.getHttpInterfaceManager(), false)
        .withMainDelegateFilter(null) // This is important, otherwise you may get NullPointerExceptions.
        .setup();

audioPlayerManager.registerSourceManager(youtubeProvider);

with Utils.getIPAdress() being:

public static String getIPAddress() {
        try {
            Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
            while (interfaces.hasMoreElements()) {
                NetworkInterface networkInterface = interfaces.nextElement();
                Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
                while (addresses.hasMoreElements()) {
                    InetAddress inetAddress = addresses.nextElement();
                    if (inetAddress instanceof java.net.Inet6Address) {
                        return inetAddress.getHostAddress();
                    }
                }
            }
        } catch (SocketException e) {
            e.printStackTrace();
        }
        return null;
    }

But sadly it doesnt work at all xD

You need a routed v6 block, ideally a /48 subnet. You can see if your provider will offer one or alternatively check out https://tunnelbroker.net/ but I think this is straying too far from what's suitable for a GitHub issue. You're free to join our Discord server if you need further help. For now, I'll be closing this issue but if it appears there's a genuine issue that isn't resolved by IP rotation, I will reopen this.