Giter Site home page Giter Site logo

Comments (4)

sedmelluq avatar sedmelluq commented on July 20, 2024 1

Closed as the relevant PR was merged.

from lavaplayer.

ducc avatar ducc commented on July 20, 2024

Disabling cookie persistence for youtube searching fixes this. Tested method (using reflection):

class DabYoutubeAudioSourceManager extends YoutubeAudioSourceManager {
  DabYoutubeAudioSourceManager() {
    super(true);

    try {
      // getting the httpInterfaceManager variable
      Field field = this.getClass().getSuperclass().getDeclaredField("httpInterfaceManager");
      field.setAccessible(true);

      // removing the final modifier
      Field modifiersField = Field.class.getDeclaredField("modifiers");
      modifiersField.setAccessible(true);
      modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);

      // creating a new HttpClientBuilder with cookie management disabled
      HttpClientBuilder httpClientBuilder = HttpClientTools.createSharedCookiesHttpBuilder()
              .disableCookieManagement();

      // creating a new HttpInterfaceManager with our HttpClientBuilder
      HttpInterfaceManager httpInterfaceManager = new ThreadLocalHttpInterfaceManager(httpClientBuilder,
              HttpClientTools.DEFAULT_REQUEST_CONFIG);

      // setting the new value of the field
      field.set(this, httpInterfaceManager);
    } catch (NoSuchFieldException | IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}

from lavaplayer.

Shredder121 avatar Shredder121 commented on July 20, 2024

Just to cover my bits when people say "there is no such (static) method in YoutubeAudioSourceManager"

YoutubeAudioSourceManager youtube = new YoutubeAudioSourceManager(true);
youtube.configureRequests(config ->
        RequestConfig.copy(config)
                .setCookieSpec(CookieSpecs.IGNORE_COOKIES)
                .build()
);

from lavaplayer.

Shredder121 avatar Shredder121 commented on July 20, 2024

Crosspost from Discord, since this seems to be the issue.
It's not a cookie problem, but it seems the DOM layout changed.

So, finally had the issue of not being able to search locally.
Peppered some breakpoints, and it seems the durationElement is null.
So, hmmm, there is another video-time related class in the DOM.
There's video-time-overlay that seems to have the right content we need for the time computation.
dom screenshot

from lavaplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.