Git Product home page Git Product logo

manganelo's Introduction

Downloads Downloads Downloads

Unofficial Manganelo (Manganato) API

Installation

Python 3.7+ (latest version requires Python 3.9+)

pip install manganelo

Examples

import manganelo

home_page = manganelo.get_home_page()

results = manganelo.get_search_results("Naruto")

for r in results:
    print(r.title, r.views)

    chapters = r.chapter_list
    
    icon_path = r.download_icon("./icon.png")

    for c in chapters:
        print(f"#{c.chapter} | {c.title}")

        chapter_path = c.download(f"./Chapter {c.chapter}.pdf")

manganelo's People

Contributors

dependabot[bot] avatar jesk3r avatar michallauer avatar mkody avatar muckas avatar nixonjoshua98 avatar

Stargazers

 avatar  avatar  avatar  avatar  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

manganelo's Issues

Files are not properly saved when using different file name

I used a different naming convention. When working with the default f"./AoT {chapter.num}.pdf", download works. However, when I change it to f"./AoT {chapter.title}.pdf", I get a blank file called "AoT Vol.1 Chapter 1" without any extension.

My guess is that since the chapter.title is
'Vol.1 Chapter 1: To You, 2,000 Years From Now'
and the blank file name is
'AoT Vol.1 Chapter 1',
the downloadchapter.py script somehow doesn't work well with : in the filename.

My script for reference (used only to save the first chapter)

from manganelo import SearchManga,  MangaInfo, DownloadChapter
import os

search = SearchManga("Attack on Titan", threaded=False)
results = search.results
best_result = results[0]
manga_info = MangaInfo(best_result.url, threaded=False)
manga_page = manga_info.results

file = f"./AoT {manga_page.chapters[0].title}.pdf"
dl = DownloadChapter(manga_page.chapters[0].url, file)
results = dl.results
if results.saved_ok:
    print(results.path, results.percent_saved)

Unable to search

Hi I tried using the library. However I get an empty list for anything I search

search = SearchManga("Mythical Realm", threaded=True)
results = list(search.results())

results is an empty list for me irrespective of the search query.

Documentation (README)

README.md should be updated to show exactly how to use the package.

  • Better format
  • Show exactly what information is produced
  • Short tutorial

Unable to search for manga with no authors

Hi. Seems like if manga has no authors, search results in an error.
As an example here "Shingeki No Kyojin - Birth Of Levi"
https://manganato.com/search/story/attack_on_titan

Python 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import manganelo
>>> manganelo.get_search_results("attack on titan")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/nvme/documents/projects/manganelo-test/venv/lib/python3.10/site-packages/manganelo/storysearch.py", line 19, in get_search_results
    return [SearchResult(ele) for ele in soup.find_all(class_="search-story-item")]
  File "/mnt/nvme/documents/projects/manganelo-test/venv/lib/python3.10/site-packages/manganelo/storysearch.py", line 19, in <listcomp>
    return [SearchResult(ele) for ele in soup.find_all(class_="search-story-item")]
  File "/mnt/nvme/documents/projects/manganelo-test/venv/lib/python3.10/site-packages/manganelo/models/searchresult.py", line 18, in __init__
    self.authors: list[str] = self._parse_authors(soup)
  File "/mnt/nvme/documents/projects/manganelo-test/venv/lib/python3.10/site-packages/manganelo/models/searchresult.py", line 35, in _parse_authors
    txt = soup.find("span", class_="text-nowrap item-author").text
AttributeError: 'NoneType' object has no attribute 'text'

Custom Exceptions

The module should handle exceptions better which the programmer can handle.

403 error when downloading image

C:\Users\pixelnull>python manga.py
Traceback (most recent call last):
  File "manga.py", line 16, in <module>
    dl = DownloadChapter(chapter.url, file)
  File "C:\Users\pixelnull\AppData\Local\Programs\Python\Python38-32\lib\site-packages\manganelo\api\downloadchapter.py", line 22, in __init__
    self._download_chapter()
  File "C:\Users\pixelnull\AppData\Local\Programs\Python\Python38-32\lib\site-packages\manganelo\api\downloadchapter.py", line 36, in _download_chapter
    image_paths = self._download_images(image_urls, temp_dir)
  File "C:\Users\pixelnull\AppData\Local\Programs\Python\Python38-32\lib\site-packages\manganelo\api\downloadchapter.py", line 77, in _download_images
    image = utils.send_request(url)
  File "C:\Users\pixelnull\AppData\Local\Programs\Python\Python38-32\lib\site-packages\manganelo\utils\__init__.py", line 38, in send_request
    r.raise_for_status()
  File "C:\Users\pixelnull\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://s6.mkklcdnv6.com/mangakakalot/d1/dead_dead_demons_dededededestruction/vol1_chapter_0_ddd_v1_chapter_extras/1.jpg

That's from a direct copy of the example code in the readme (with Naruto changed ofc). It got to "vol1_chapter_0_ddd_v1_chapter_extras" so I'm guessing it's correct all the way up until it gets a 403. Which I don't know what you would do about. I can access it when I go to the image directly in firefox 76.0.1, so it might just need a useragent change. I would pull it but don't really have time rn.

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0'}

r = requests.get(url, headers=headers)

That would probably work, but I'm not sure how it'd fit into your code.

Love the idea of the project and starred/followed it though.

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.