Giter Club home page Giter Club logo

sakurajima's Introduction

Sakurajima

Pypi downloads

Sakurajima is a Python API wrapper for AniWatch.

Disclaimer

Using this tool comes with a high risk of getting banned on AniWatch.

Installation

Use the package manager pip to install Sakurajima.

pip install sakurajima

Usage

Get you user details. If you have no idea how to do that feel free to read our guide.

from Sakurajima import Sakurajima
if __name__ == "__main__":
  # Setup our instance of Sakurajima
  #                    Username      User ID   Auth token
  client = Sakurajima("Sakurajima", "106960", "J2ltJtj9yg1bmly4vKVZWcJe7PKlOF05")
  my_anime = client.search("Somali to Mori no Kamisama")[0] # Search for "Somali to Mori no Kamisama" and get the first Anime object in the list
  all_episodes = my_anime.get_episodes() # Get all the episodes from our Anime object
  episode = all_episodes.get_episode_by_number(4) # Get the 4th episode from our all_episodes object, you can also use all_episodes[3]
  episode.download("fullhd", "Somali - Ep. 4", True) # Download the episode in 1080p into "Somali - Ep. 4.mp4" using multiple threads

If you have problems playing downloaded videos in the default windows player you can use ffmpeg to merge the chunks or include the intro chunk.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

sakurajima's People

Contributors

dhanrajhira avatar notmarek avatar silvershade1337 avatar trimvis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sakurajima's Issues

Feasibility of merging the experimental branch into master.

Should we prioritize the merging of the experimental branch into master? The experimental branch is very far ahead of the master branch. I think we should focus on testing before we move on to adding new features. What do you think?

Should we start a new project on this?

Requests being blocked after commit c21a3a6.

API requests are being blocked by Cloudfare after the recent commit. I have double checked my username, user ID and auth token (called 'X-AUTH' token internally). Any ideas?

The default file name for downloaded episodes should be more descriptive.

Currently, not passing in a value for the 'file_name' argument in the 'download' method just names the file as 'download.ts'. This needs to change as not only is it non-descriptive, it can also lead to issues when downloading more than one file as the new file just overwrites the old one since they have the same name.

Changing the way we handle sessions.

Currently we use the Session object as a context manager. This closes the Session immediately after every request, essentially sidestepping any performance benefits that using session objects can provide through connection pooling. This needs to change.

The requests should thus be made using try-except blocks.

Downloaded video file unplayable.

The download completes without issues but the resultant .mp4 file is unplayable.

My guess

Skiping the first chunk (intro) causes this issue.

Discussion regarding recent changes made to the downloading functionality.

Recently we changed the way downloads are handled, ffmpeg is now required for downloads to work, I think we have made the API less accessible to new comers by introducing this pretty big requirement, The default media player on windows is able to play '.ts' files. Can we look into making converting to mp4 optional so that ffmpeg can be made an optional requirement to improve accessibility.

Setup Github pages to host documentation.

Kindly setup GIthub Pages to host documentation for the API. I think this will be easiest way for us to provide documentation, if you know of some other way kindly suggest that too. I am not too experienced with this sort of thing so any input will be appreciated.

Using Sphinx to document the API

Yesterday,I was working on documenting the Anime class. To be honest, I felt kind of limited using markdown for documentation, I felt that the formatting using vanilla markdown is just not satisfactory. I was looking into this and found out about a tool called Sphinx that can be used to document python modules.

Here is a video briefly showing what all this is about.

What do you think?

The need for a `Friend` class.

Currently the get_user_friends() method returns a raw JSON response. We need to make a data model class for this. Also I think that get_friends() is a better name for this method.

Discussing some recent changes.

I have recently made quite a lot of changes to the API, but I have not talked about any of them. I apologize for this, I am making this thread to discuss recent changes, what I changed and my rationale behind it.

  • Changes

    • All the code that deals with downloading episodes has been shifted to the modules in utils package. See #27
    • New classes namely Downloader, MultiThreadDownloader, ChunkDownloader, StatefulSegmentList, ChunkMerger,
      FFmpegMerger and ChunkRemover have been introduced.
    • Concurrency is now achieved using threads instead of processes. Since our use case is I/O limited, threads are a better
      choice due to the lower overhead.
    • The number of threads that are used for downloading can now be limited using the MultiThreadDownloader class.
    • Single threaded downloads now show a progress bar. I plan to extend this to multi threaded downloads as well.
    • Single threaded downloads can now be resumed using Kurisu I was unsure of where to put this so I made a separate repo
      for this. I will update this post with a link to that repo when I finish setting it up. (I have tested this and it works). Here is the
      link

All the new downloading changes are implemented using the download_using_downloader() method. The hope is that in the future we can simply rename this method to download() and remove the old download() method.

Need for documentation.

We are sorely lacking in the documentation department. This will become an even greater issue when we finally decide to merge the experimental branch into master. With the introduction of data models, we are greatly increasing the complexity of the library.
We need to work on some form of documentation.

Abstracting download functionality behind a new class.

Currently, all the code that implements download functionality lives in the Episode class, The Episode class was originally meant to be a data model class, as things went on and we developed the download functionality the class became really bloated.

Why should we abstract downloading

  • It will debloat the Episode class
  • It will increase modularity
  • It will make it possible to further extend downloading (like implementing progress bars) easier.

What do you think.

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.