Update workflows/publish_pypi.yml
[manga-dl.git] / manga_py / providers / mangaonline_today.py
blobebcdd4a310d2c6003cc8a585be160653f209a96c
1 from manga_py.provider import Provider
2 from .helpers.std import Std
5 class MangaOnlineToday(Provider, Std):
6 _img_selector = '#sct_content img'
8 def get_chapter_index(self) -> str:
9 idx = self.re.search(r'\.\w{2,7}/[^/]+/([^/]+)', self.chapter)
10 return idx.group(1).replace('.', '-')
12 def get_content(self):
13 return self._get_content('{}/{}/')
15 def get_manga_name(self) -> str:
16 return self._get_name(r'\.\w{2,7}/([^/]+)')
18 def get_chapters(self):
19 return self._elements('ul.chp_lst a')
21 def _pages_helper(self, options):
22 images = []
23 chapter = self.chapter
24 for n in range(1, int(options)):
25 content = self.html_fromstring('{}{}/'.format(chapter, n * 2 + 1))
26 img = content.cssselect(self._img_selector)
27 for i in img:
28 images.append(i.get('src'))
29 return images
31 def get_files(self):
32 images = []
33 content = self.html_fromstring(self.chapter)
34 img = content.cssselect(self._img_selector)
35 if img:
36 images = [i.get('src') for i in img]
38 options = len(content.cssselect('.cbo_wpm_pag')[0].cssselect('option')) / 2 + .5
39 return images + self._pages_helper(options)
41 def get_cover(self):
42 pass # TODO
44 def book_meta(self) -> dict:
45 # todo meta
46 pass
49 main = MangaOnlineToday