Giter Site home page Giter Site logo

chris-peterson444 / mangadex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emacc99/mangadex

0.0 0.0 0.0 101 KB

A python wrapper for the mangadex API V5. Work in progress

Home Page: https://pypi.org/project/mangadex/

License: MIT License

Python 100.00%

mangadex's Introduction

mangadex

A python wrapper for the mangadex API V5. It uses the requests library and all the aditional arguments can be viewed in the Official Mangadex Documentation

Instaling the API

PyPI

pip install --Upgrade mangadex

Installing via setuptools

python setup.py install --user

Using the API

>>> import mangadex
>>> api = mangadex.Api()

Public Calls

Getting the latest manga

This is called mangalist in the documentation

>>> manga_list = api.get_manga_list(limit = 1) #limits the query to return just one manga
>>> manga_list[Manga(manga_id = 0001183c-2089-48e9-96b7-d48db5f1a611, title = {'en': 'Eight'}, altTitles = [{'ja': '8(エイト)'}], description = {'en': 'Tokyo in the 90s, the city center has been suffering from a continuing depopulation. Also affected is the Udagawa Junior High School where only six people are left, as their class leader, protector and very good friend Masato just died in an illegal skateboarding race. Five months later Eito Hachiya, nickname: Eight or "8" enrolls in school and wants to find out what happened. He even just looks like Masato! But mysteries surround him: Why does he know all the other six? Why can’t they remember him?  \n  \nNote: Was cancelled after ~25% of volume 4, the epilogue consists of an alternative ending for Eight.'}, isLocked = False, links = {'al': '38734', 'ap': 'eight', 'kt': '17709', 'mu': '6521', 'amz': 'https://www.amazon.co.jp/dp/B07WS2K894', 'mal': '8734', 'raw': 'https://csbs.shogakukan.co.jp/book?book_group_id=14478'}, originalLanguage = ja
 lastVolume = 4, lastChapter = 37.6, publicationDemographic = seinen, status = completed, year = 2000, contentRating = safe
 createdAt = 2018-02-04 21:32:02+00:00, uploadedAt = 2022-01-12 21:42:40+00:00), author_id = ['905aaced-1556-4925-bff0-14ea277fb0b1', '905aaced-1556-4925-bff0-14ea277fb0b1'], artist_id = [], cover_id = 51bf2e88-98ac-4fd7-afb5-80edff694d53

You can also use the get_manga_list() method to search for manga.

The usage is like this

>>> manga_list = api.get_manga_list(title = "You manga title here")

NOTE: The search rigth now is faulty but tahts is an api problem. At the moment the only parameters that work are: title, limit and offset

The search is now working so the above is no longer true

Getting a manga by its id

>>> manga = api.view_manga_by_id(manga_id = "0001183c-2089-48e9-96b7-d48db5f1a611")

Random manga

>>> random_manga = api.random_manga()

Manga Feed

Get the chapter, or chapters from the feed of a specific manga.

>>> manga_feed = api.manga_feed(manga_id = "0001183c-2089-48e9-96b7-d48db5f1a611", limit = 1)
[Chapter(chapter_id = 015979c8-ffa4-4afa-b48e-3da6d10279b0, title = Navel-Gazing, volume = 3, chapter = 23.0, translatedLanguage = en, hash =
 data = List[filenames], publishAt = 2018-03-19 01:32:00+00:00, createdAt = 2018-03-19 01:32:00+00:00, uploadedAt = 2018-03-19 01:32:00+00:00, group_id = 59957a04-fa91-4099-921d-7e7988a19acb, manga_id = 0001183c-2089-48e9-96b7-d48db5f1a611, uploader = e19519ce-8c5f-4d7c-8280-704a87d34429)]

Get manga volumnes and chapters

Get a manga volumes and chapters

>>> api.get_manga_volumes_and_chapters(manga_id = "the manga id")

Get Chapter

Returns a Chpater Object by its id

>>> chapter = api.get_chapter(chapter_id = "015979c8-ffa4-4afa-b48e-3da6d10279b0")
>> chapter
Chapter(chapter_id = 015979c8-ffa4-4afa-b48e-3da6d10279b0, title = Navel-Gazing, volume = 3, chapter = 23.0, translatedLanguage = en, hash =
data = List[filenames], publishAt = 2018-03-19 01:32:00+00:00, createdAt = 2018-03-19 01:32:00+00:00, uploadedAt = 2018-03-19 01:32:00+00:00, group_id = 59957a04-fa91-4099-921d-7e7988a19acb, manga_id = 0001183c-2089-48e9-96b7-d48db5f1a611, uploader = e19519ce-8c5f-4d7c-8280-704a87d34429)

Chapter List

It will return a list of chapters

>>> chapter_list = api.chapter_list()

If you want the chpaters of a given Manga, you'll need to specify the feed endpoints

Chapter Images

Return the links for the chapter images for a given Chapter Object. This is a Chapter method

>>> Chapter.fetch_chapter_images()

Get User

Get a User by id

>>> user = api.get_user(user_id = "id of user")

Tag List

The list of the manga tags

>>> tag_list = api.tag_list()

Get scanlation group list

Get a Scanlation Group list

>>> api.scanlation_group_list()

Cover Images List

Get the cover image list

>>> api.get_coverart_list()

Get Cover by Id

>>> api.get_cover(cover_id = "the cover id")

Edit Cover

>>> api.edit_cover(cover_id = "the cover id", description = "the cover description, can be null", volume = "the volume number", version = "int, the cover version")

Get cover image link

>>> CoverArt.fetch_cover_image()

This is a CoverArt method that returns the cover image url of that object

Create account

To create an account

>>> api.create_account(username = "your username", password = "your password", email = "[email protected]", ObjReturn = False)

This will send you an activation code, this is the one to pass to activate_account.

>>> api.acticate_account(code = "the code sent")

If you need another activation code:

>>> api.resend_activation_code(email = "[email protected]")

Account recovery

To recover and account

>> api.recover_account(email = "[email protected]")

This will send you and activation code that you need

>>> api.complete_account_recover(code = "the code sent to you", newPassword = "the new password for the account")

Private Calls

Login

Method to login to the website

>>> api.login(username = USERNAME, password = PASSWORD)

It is recomended that you add this values to you path for security reasons.

Your User Info

Get your user info

>>> my_user = api.me()

Get Logged User Followed Manga List

Get your manga follow list!

>>> follow_list = api.get_my_mangalist()

This functions, as well as most of the other ones accept optional parameters. This are:

  • limit : limits the amout of results. It accepts a value between 1 and 100, the default if 10
  • offset : Makes an offset of the velue provided to the list. Accepts values >= 0

Get Logged User Followed Groups

Get the list of the Scanlination group you follow!

>>> scangroups_followlist = api.get_my_followed_groups()

Get Logged User Followed Users

The list of the users you follow

>>> followed_users = api.get_my_followed_users()

Get chapters marked as read from a manga

Get a list of the capters marked as read for a given manga

>>> read_chapters = api.get_manga_read_markes(id = "the manga id")

Get all followed manga reading status

Get a list of the all the manga reading stauts

>>> my_manga_reading_stauts = api.get_all_manga_reading_status()

Get a specific manga reading status

Get the reading status of a specific manga

>>> manga_reading_status = api.get_manga_reading_status(manga_id = "the manga id")

Update Manga reading status

>>> api.update_manga_reading_status(manga_id = "the manga id", status = "the new reading status")

The status parameter can take the following values: "reading" "on_hold" "plan_to_read" "dropped" "re_reading" "completed"

Follow a manga

Follow a manga

>>> api.follow_manga(manga_id = "the manga id")

Unfollow a manga

Unfollows a manga

>>>api.unfollow_manga(manga_id = "the manga id")

Create manga

Creates a manga

>>> api.create_manga(title = "manga title", )

Update Manga

Updates a manga

>>> api.update_manga(manga_id = "the manga id")

Delete Manga

Deletes manga

>>> api.delete_manga(manga_id = "the manga id")

Add manga to custom list

Add a manga to a custom list

>>> api.add_manga_to_customlist(manga_id = "the manga id", list_id = "the list id")

Remove a manga from custom list

Removes a manga from a custom list

>>> api.remove_manga_from_customlist(id = "the manga id", listId = "the list id")

Create a custom list

>>> api.create_customlist() #this will create a custom list with no special parameters

Query parameters

  • name. The custom list name
  • visibility. The visibility of the custom list. Default public
  • manga. The list of manga ids

Get custom list

>>> api.get_customlist(id = "th custom list id")

Update custom list

>>> api.update_customlist(id = "the custom list id")

Query parameters

  • name. The custom list name
  • visibility. Values : "public" "private"

Delete custom list

>>> api.delete_customlist(id = "the custom list id")

Get User Custom list

>>> api.get_user_customlists(id = "the user id")

QueryParams

  • limit. The limit of custom lists to return
  • offset. The amout of offset

Create Author

>>> api.create_author(name = "author name", version = 1, ObjReturn = False)

Update Author

>>> api.update_author(id = "the author id", version = "int with the version", name = "author's name", ObjReturn = False)

Delete Author

>>> api.delete_author(id = "the author id")

Discalimer

All the credit for the API goes to the Mangadex Team.

mangadex's People

Contributors

emacc99 avatar

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.