Py-Manga's Documentation!
Total Page:16
File Type:pdf, Size:1020Kb
py-manga Allie Sep 06, 2021 CONTENTS: 1 pymanga 1 1.1 pymanga package.............................................1 2 Indices and tables 15 Python Module Index 17 Index 19 i ii CHAPTER ONE PYMANGA 1.1 pymanga package 1.1.1 Subpackages pymanga.parsers package Submodules pymanga.parsers.adv_search_parser module pymanga.parsers.adv_search_parser.parse_results(soup) Parse search results from the advanced search page. Parameters content (BeautifulSoup) – BeautifulSoup object of the search page content. Returns results – List of search results. [ { 'name': 'Series Name', 'id': 'Series ID', 'rating': 'Average Rating', 'summary': 'Short summary', 'thumbnail': 'Thumbnail link' or None, 'year': 'Year manga started releasing', 'is_adult': True or False # note! mangaupdates categorizes whole genres like 'Yuri' as adult # so use this at your own discretion :) # if this is true, thumbnail will always be None. } ] Return type list of dicts 1 py-manga pymanga.parsers.releases_parsers module pymanga.parsers.releases_parsers.parse_releases(content) Parse latest releases of a manga Parameters content (BeautifulSoup) – BeautifulSoup object of the releases page content. Returns releases – List of latest releases of a manga. List is ordered latest-to-oldest [ { 'chapter': 'chapter number', 'vol': 'volume number' or None, 'series':{ 'name': 'Manga Name', 'id': 'Manga ID' }, 'group':{ 'name': 'Scanlation Group Name', 'id': 'Scanlation Group ID' } } ] Return type list of dicts pymanga.parsers.search_parsers module pymanga.parsers.search_parsers.parse_authors(list) Parse authors from a MangaUpdate’s search results page. Parameters list (BeautifulSoup) – BeautifulSoup object of the authors section of the search results page. Returns series – List of authors found by the search. [ { 'name': 'Author Name', 'id': 'ID', 'series': int(Number of series author has done), 'genres':['Genre',...] # most numerous genre(s) # in this author's work } ] Return type list of dict pymanga.parsers.search_parsers.parse_releases(list) Parse releases from a MangaUpdate’s search results page. Parameters list (BeautifulSoup) – BeautifulSoup object of the releases section of the search page. 2 Chapter 1. pymanga py-manga Returns releases – List of recent releases found by the search. [ { 'id': 'Series Id', 'name': 'Series name', 'chp': 'chapter number', 'vol': 'number' or None, 'date': '02/21/21', # Date in month/day/year 'group':{ 'name': 'Scanlation Group', 'id': 'Scanlation Group Id' } } ] Return type list of dicts pymanga.parsers.search_parsers.parse_scanlators(list) Parse scanlation groups from a MangaUpdate’s search results page. Parameters list (BeautifulSoup) – BeautifulSoup object of the scanlators section of the search results page. Returns scanlators – List of scanlation groups found by the search. [ { 'name': 'Scanlation Group Name', 'id': 'Scanlation Group ID', 'active': True or False, 'contact':[ 'contact link', ... ] } ] Return type list of dicts pymanga.parsers.search_parsers.parse_series(list) Parse series from a MangaUpdate’s search results page. Parameters list (BeautifulSoup) – BeautifulSoup object of the series section of the search re- sults page. Returns series – List of manga found by the search. [ { 'name': 'Manga Name', 'id': 'Manga Id', (continues on next page) 1.1. pymanga package 3 py-manga (continued from previous page) 'rating': '7.80' # average (?) rating of manga on mangaupdates, 'year': '2018', # year manga started releasing 'genres':['Drama', 'Shoujo Ai', 'S...'] # genres this series ,!is a part of # (note: sometimes, the last item of this will be cut off with . ,!..) } ] Return type list of dicts pymanga.parsers.series_parsers module pymanga.parsers.series_parsers.parse_series(content, description_format='markdown') Parse series info from mangaupdates. Parameters • content (BeautifulSoup) – BeautifulSoup object of series page html. • description_format (str, optional) – Format to transform the description into. can be ‘plain’, ‘raw’ or ‘markdown’. defaults to ‘markdown’. Returns series – Series information. { # main info 'title': 'Series Name', 'year': 'type': 'Type of series (manhwa,manhua,manga,et)', 'status': 'n Volumes (Ongoing or Complete or etc..)' 'image': 'cover image link', 'last_updated': 'December 3rd 2020, 5:32pm PST', # last time page ,!was updated # authors & artists 'artists':[ { 'id': 'Artist's Manga Updates ID', 'name': 'Artist's Name' } ], 'authors':[ { 'id': 'Author's Manga Updates ID', 'name': 'Author's Name' } ], # relations 'associated_names':[ # often in different languages, so make sure ,!you can handle unicode. 'Name one', 'Name two' (continues on next page) 4 Chapter 1. pymanga py-manga (continued from previous page) ], 'related_series':[ { 'id': 'Related Series ID', 'name': 'Related Series Name', 'relation': 'Relation to current manga' } ], 'anime_chapters':[ # if it doesn't have an anime, list will be empty 'Starts at Vol x, Chap y', 'Ends at Vol z, Chap w' ], # description & genre 'genres':[ 'Genre', ... ], 'categories':[ { 'category': 'Category Name', 'score': '16 (16,0)' } ], 'description': 'Lorem ipsum dolor sit amet..', # publishing info 'publisher':{ 'id': 'publisher ID', 'name': 'publisher name' }, 'serialized':{ 'link': 'mangaupdates link to where it was serialized', 'name': 'name of where it was serialized' }, 'licensed': True or False # whether this series was licensed in ,!english, 'english_publisher':{ 'id': 'English Publisher ID', 'name': 'English Publisher Name + Volume Info' }, # scanlation info 'completely_scanlated': True or False, 'latest_releases':[ { 'chapter': 'chapter number', 'volume': 'volume number if present', 'date': 'n days ago', 'group':{ 'id': 'Scanlation Group ID', 'name': 'Scanlation Group Name' } } ], (continues on next page) 1.1. pymanga package 5 py-manga (continued from previous page) 'groups':[ # all scanlation groups that published releases for ,!this series { 'id': 'Scanlation Group ID', 'name': 'Scanlation Group Name' } ], # recommendations 'category_recs':[ { 'id': 'Recommended Series ID', 'name': 'Recommended Series Name' } ], 'recs':[ { 'id': 'Recommended Series ID', 'name': 'Recommended Series Name' } ], # user-related info 'positions':{ 'monthly': '779', 'monthly_change': '+155', 'six_monthly': '1244', 'six_monthly_change': '+76', 'tri_monthly': '1120', 'tri_monthly_change': '-17', 'weekly': '431', 'weekly_change': '+121', 'yearly': '1277', 'yearly_change': '-162' }, 'average':{ # ratings 'average': 'average rating', 'bayesian': 'bayesian average rating', 'votes': 'n votes' }, 'reading_lists':{ 'custom': 'n', 'reading': 'n', 'unfinished': 'n', 'wish': 'n' }, 'forum':{ 'link': 'https://www.mangaupdates.com/topics.php?fid=120202', 'status': 'None' } } Return type dict 6 Chapter 1. pymanga py-manga Module contents 1.1.2 Submodules 1.1.3 pymanga.api module pymanga.api.advanced_search(params, all_pages=False, page=1) Do an ‘advanced search’ of MangaUpdates’ manga. Parameters • params (dict) – Dict of parameters to search by. { 'orderby': 'rating' or 'title' or 'year', # how to sort search ,!results, 'category':['MangaUpdates','Categories/Tags'], 'genre':['Genres', 'To', 'Include'], # for a list of possible ,!values 'exclude_genre':['Genres', 'To', 'Exclude' # see 'pymanga.genres' 'licensed': empty or 'yes' or 'no', # empty/not specified -> show all # 'yes' -> show only licensed manga # 'no' -> show only unlicensed manga 'filter': empty or 'filtering option', # empty/not specified -> show all # 'scanlated' -> only completely scanlated manga # 'completed' -> only completed manga (includes oneshots) # 'oneshots' -> only show oneshots # 'no_oneshots' -> excludes oneshots # 'some_releases' -> only show manga with at least one release # 'no_releases' -> only show manga with no releases 'type': empty or 'type option', # 'artbook' # 'doujinshi' # 'drama_cd' # 'filipino' # 'indonesian' # 'manga' # 'manhwa' # 'manhua' # 'novel' # 'oel' # 'thai' # 'vietnamese' # 'malaysian' } • all_pages (bool, optional) – Fetch all results pages or not. Defaults to False. 1.1. pymanga package 7 py-manga Note: the module automatically sleeps between requests if all_pages is set to true, as to not overload MangaUpdates. Consider using advanced_search_iter instead. • page (int, optional) – What page of results to fetch. Defaults to 1. Returns results – List of search results. [ { 'name': 'Series Name', 'id': 'Series ID', 'rating': 'Average Rating', 'summary': 'Short summary', 'thumbnail': 'Thumbnail link' or None, 'year': 'Year manga started releasing', 'is_adult': True or False # note! mangaupdates categorizes whole genres like 'Yuri' as adult # so use this at your own discretion :) # if this is true, thumbnail will always be None. } ] Return type list of dicts See also: pymanga.genres, pymanga.api.advanced_search_iter pymanga.api.advanced_search_iter(params) Same as pymanga.api.advanced_search, but as a generator. Requests new pages from mangaupdates only as needed. See also: pymanga.api.advanced_search pymanga.api.releases(id) Get latest releases of a manga Parameters id (str) – Manga ID. Returns releases – List of latest releases of a manga. List is ordered latest-to-oldest [ { 'chapter': 'chapter number', 'vol': 'volume number' or None, 'series':{ 'name': 'Manga Name', 'id': 'Manga ID' }, 'group':{ 'name': 'Scanlation Group Name', (continues on next page) 8 Chapter 1. pymanga py-manga (continued from previous page) 'id': 'Scanlation Group ID' } } ] Return type list of dicts pymanga.api.search(query) Performs a name-based search of MangaUpdates. Parameters query (str) – Name to search by. Returns