Update workflows/publish_pypi.yml
[manga-dl.git] / manga_py / providers / manga_online_biz.py
blob6fd372db4cdb7f3c9db4e43b54f4d8973a48ab6e
2 from manga_py.provider import Provider
3 from manga_py.download_methods import WholeArchiveDownloader
4 from .helpers.std import Std
6 # Archive downloading example. Without images
7 class MangaOnlineBiz(Provider, Std):
8 _downloader = WholeArchiveDownloader
9 chapter_url = ''
11 def get_chapter_index(self) -> str:
12 url = self.chapter
13 idx = self.re.search(r'/download/[^/]+/.+?_(\d+)_(\d+)', url).groups()
14 return '{}-{}'.format(*idx)
16 def get_content(self):
17 return self._get_content('{}/{}.html')
19 def get_manga_name(self) -> str:
20 return self._get_name(r'\.\w{2,7}/([^/]+)(?:/|\.html)')
22 def _after_download(self, idx, _path):
23 self._idx = idx + 1
25 def get_chapters(self):
26 s, c = r'MangaChapter\((.+)\);', self.content
27 items = self.json.loads(self.re.search(s, c).group(1))
28 return [i.get('downloadUrl') for i in items]
30 def get_files(self):
31 return []
33 def get_cover(self):
34 return self._cover_from_content('.item > .image > img')
36 def book_meta(self) -> dict:
37 # todo meta
38 pass
40 def chapter_for_json(self):
41 return self.chapter_url
44 main = MangaOnlineBiz