| 66 | example = "https://fanfox.net/manga/TITLE" |
| 67 | |
| 68 | def chapters(self, page): |
| 69 | results = [] |
| 70 | chapter_match = MangafoxChapterExtractor.pattern.match |
| 71 | |
| 72 | extr = text.extract_from(page) |
| 73 | manga = extr('<p class="title">', '</p>') |
| 74 | author = extr('<p>Author(s):', '</p>') |
| 75 | extr('<dd class="chlist">', '') |
| 76 | |
| 77 | genres, _, summary = text.extr( |
| 78 | page, '<div class="manga-genres">', '</section>' |
| 79 | ).partition('<div class="manga-summary">') |
| 80 | |
| 81 | data = { |
| 82 | "manga" : text.unescape(manga), |
| 83 | "author" : text.remove_html(author), |
| 84 | "description": text.unescape(text.remove_html(summary)), |
| 85 | "tags" : text.split_html(genres), |
| 86 | "lang" : "en", |
| 87 | "language" : "English", |
| 88 | } |
| 89 | |
| 90 | while True: |
| 91 | url = "https://" + extr('<a href="//', '"') |
| 92 | match = chapter_match(url) |
| 93 | if not match: |
| 94 | return results |
| 95 | _, cstr, volume, chapter, minor = match.groups() |
| 96 | |
| 97 | chapter = { |
| 98 | "volume" : text.parse_int(volume), |
| 99 | "chapter" : text.parse_int(chapter), |
| 100 | "chapter_minor" : minor or "", |
| 101 | "chapter_string": cstr, |
| 102 | "date" : self.parse_datetime( |
| 103 | extr('right">', '</span>'), "%b %d, %Y"), |
| 104 | } |
| 105 | chapter.update(data) |
| 106 | results.append((url, chapter)) |