Proxymiity/MangaDex.py

are there anyway to retieve chatper pages?

Opened this issue · 1 comments

i read the docs.
and i guess there is no way to retieve a chapter's pages urls.
is there anyway i can do it?

You maybe did not read the documentation carefully.
Here’s the page about MD@H, it has examples on how to retrieve download links and what you should do after downloading them.
You can also take a look at the downloader.py file:

def dl_page(net, page, pages_total, path):
"""Helper for dl_chapter to download pages with."""
try:
with net.client.session.get(page) as p:
name = page_name_to_integer(page.rsplit("/", 1)[1], pages_total)
with open(str(Path(path + "/" + name)), "wb") as f:
f.write(p.content)
success = True if p.status_code <= 400 else False
try:
cached = True if p.headers["x-cache"] == "HIT" else False
except KeyError: # No cache header returned: the client is at fault
cached = False
try:
net.report(page, success, cached, len(p.content), int(p.elapsed.microseconds/1000))
except APIError:
print("Network report failed. If you're downloading from upstream, this is normal... I guess?")
print(f"Statistics for {page}\nTime: {int(p.elapsed.microseconds/1000)}, length: {len(p.content)}"
f"\nSuccess: {success}, was cached on server: {cached}\nHeaders: {p.headers}")
return True
except rex.RequestException:
net.report(page, False, False, 0, 0)
print(f"Request for {page} failed. This was reported to the MD backend, you should try to download the image"
f" again to get a new server.")
return False