NyaaSi-API icon indicating copy to clipboard operation
NyaaSi-API copied to clipboard

Updates for Current nyaa.si Site

Open blacktide082 opened this issue 3 years ago • 0 comments

I have made these changes in my fork and would like to contribute them upstream. There were a couple of issues that made this library unusable in its current state (as you have expected it to break).

  • Problem 1 - CSRF tokens are no longer present anywhere on nyaa.si or sukebei.nyaa.si. This actually makes this library unusable for anything other than searching torrents, as each method fails with a Jsoup exception not being able to find the csrf_token field.
  • Problem 2 - Login is now protected by a Google reCAPTCHA, so login is not working.

This PR adds the following:

  • Deprecates the usage all public API methods related to CSRF tokens.
  • Removes CSRF token from all internal requests and associated private methods.
  • Deprecated the username and password login.
  • Adds a new public login using a user's session cookie directly, which needs to be retrieved by logging in using a browser and retrieving from cookie storage.
  • Adds a new constructor to remove the redundant usage of isSukebei in the NyaaSiAuthApiImpl class and deprecates the old constructor.
  • Resolves an issue with Japanese characters in torrent name and description showing up as ???? on Nyaa's website after calling uploadTorrent.
  • Fix minor spelling issue of sukebei in Session. Deprecate the misspelled method.
  • Updates the examples package to show examples with the new changes.
  • Adds accompanying Gradle files for Java developers that may not have sbt (I added this for my own benefit, but I am willing to remove it if you do not care for this).
  • Resolves the issue from #1 in Gradle. I'm not familiar with sbt so I have not fixed the build.sbt file.

I have tested all of the methods in the API and everything is working properly with these changes. Feel free to let me know if you have any questions and I look forward to your review.

blacktide082 avatar Jul 20 '21 16:07 blacktide082