File: m.py

package info (click to toggle)
dosage 3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,400 kB
  • sloc: python: 12,703; sh: 55; makefile: 6
file content (230 lines) | stat: -rw-r--r-- 7,012 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: © 2004 Tristan Seligmann and Jonathan Jacobs
# SPDX-FileCopyrightText: © 2012 Bastian Kleineidam
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
# SPDX-FileCopyrightText: © 2019 Daniel Ring
import json
from re import IGNORECASE, compile

from ..helpers import indirectStarter, joinPathPartsNamer
from ..scraper import ParserScraper, _BasicScraper, _ParserScraper
from ..util import tagre
from .common import ComicControlScraper, WordPressScraper, WordPressWebcomic


class MacHall(ComicControlScraper):
    url = 'https://www.machall.com/'
    stripUrl = url + 'comic/%s'
    firstStripUrl = stripUrl % 'moving-in'


class MadamAndEve(_BasicScraper):
    url = 'http://www.madamandeve.co.za/'
    stripUrl = None
    imageSearch = compile(tagre('img', 'src', r'(/cartoons/me\d{6}\.(gif|jpg))'))
    multipleImagesPerStrip = True


class Magellan(WordPressScraper):
    url = 'https://magellanverse.com/'
    firstStripUrl = url + 'comic/20040307wannabe/'


class MagickChicks(ComicControlScraper):
    url = 'https://pixietrixcomix.com/magick-chicks/'
    stripUrl = url + '%s'
    firstStripUrl = stripUrl % 'tis-but-a-trifle-2'
    help = 'Index format: name'
    endOfLife = True


class ManlyGuysDoingManlyThings(WordPressScraper):
    url = 'https://thepunchlineismachismo.com/'
    stripUrl = url + 'archives/comic/%s'
    firstStripUrl = stripUrl % '02222010'
    help = 'Index format: ddmmyyyy'


class MareInternum(WordPressScraper):
    url = 'https://www.marecomic.com/'
    stripUrl = url + 'comic/%s/'
    firstStripUrl = stripUrl % 'intro-page-1'


class Marilith(ParserScraper):
    url = 'https://web.archive.org/web/20170619193143/http://www.marilith.com/'
    stripUrl = url + 'archive.php?date=%s'
    firstStripUrl = stripUrl % '20041215'
    imageSearch = '//img[contains(@src, "comics/")]'
    prevSearch = '//a[img[@name="previous_day"]]'
    help = 'Index format: yyyymmdd'


class MarriedToTheSea(ParserScraper):
    url = 'http://marriedtothesea.com/'
    stripUrl = url + '%s'
    firstStripUrl = stripUrl % '022806'
    imageSearch = '//div[d:class("jumbotron")]//p/img'
    prevSearch = '//a[contains(text(), "Yesterday")]'
    namer = joinPathPartsNamer(imageparts=range(2), joinchar='-')
    help = 'Index format: mmddyy'


class MarryMe(ParserScraper):
    stripUrl = 'http://marryme.keenspot.com/d/%s.html'
    url = stripUrl % '20191001'
    firstStripUrl = stripUrl % '20120730'
    imageSearch = '//img[@class="ksc"]'
    prevSearch = '//a[@rel="prev"]'
    endOfLife = True
    help = 'Index format: yyyymmdd'


class Meek(WordPressScraper):
    url = 'https://www.meekcomic.com/'
    stripUrl = url + 'comic/%s/'
    firstStripUrl = stripUrl % 'chapter-1-cover'


class MegaTokyo(_BasicScraper):
    url = 'https://megatokyo.com/'
    stripUrl = url + 'strip/%s'
    firstStripUrl = stripUrl % '1'
    imageSearch = compile(r'"(strips/.+?)"', IGNORECASE)
    prevSearch = compile(r'"(./strip/\d+?)">Prev')
    help = 'Index format: nnnn'


class Meiosis(WordPressScraper):
    url = 'http://meiosiswebcomic.com/'


class Melonpool(WordPressScraper):
    url = 'http://www.melonpool.com/'
    allow_errors = (500,)


class MenageA3(ComicControlScraper):
    adult = True
    url = 'https://pixietrixcomix.com/menage-a-3/'
    firstStripUrl = url + 'for-new-readers'
    endOfLife = True


class Metacarpolis(ComicControlScraper):
    url = 'http://www.metacarpolis.com'


class Misfile(ComicControlScraper):
    url = 'http://www.misfile.com/misfile/'
    stripUrl = url + '%s'
    firstStripUrl = stripUrl % '2004-02-22'
    endOfLife = True
    help = 'Index format: yyyy-mm-dd'


class MisfileHellHigh(Misfile):
    name = 'Misfile/HellHigh'
    url = 'http://www.misfile.com/hell-high/'
    stripUrl = url + '%s'
    firstStripUrl = stripUrl % '2019-08-29'
    help = 'Index format: yyyy-mm-dd'


class MistyTheMouse(ParserScraper):
    url = 'http://www.mistythemouse.com/'
    imageSearch = '//center/p/img'
    prevSearch = '//a[img[contains(@src, "Previous")]]'
    firstStripUrl = url + 'The_Live_In.html'


class MonkeyUser(ParserScraper):
    url = 'https://www.monkeyuser.com/'
    imageSearch = '//div[d:class("content")]/p/img'
    prevSearch = '//a[d:class("link-reverse")]'
    latestSearch = '//div[d:class("comic")]/a'
    starter = indirectStarter

    def shouldSkipUrl(self, url, data):
        # videos
        return self.match(data, '//div[d:class("video-container")]')


class MonsieurLeChien(ParserScraper):
    url = ('https://web.archive.org/web/20210311002403/'
        'http:/www.monsieur-le-chien.fr/')
    stripUrl = url + 'index.php?planche=%s'
    firstStripUrl = stripUrl % '2'
    lang = 'fr'
    imageSearch = '//img[contains(@src,"i/planches/")]'
    prevSearch = '//a[img[contains(@src,"i/precedent.gif")]]'
    endOfLife = True
    help = 'Index format: n'


class MonsterSoup(WordPressScraper):
    url = 'https://monstersoupcomic.com/'
    stripUrl = url + '?comic=%s'
    firstStripUrl = stripUrl % 'chapter-1-cover'


class Moonlace(WordPressWebcomic):
    url = 'https://moonlace.darkbluecomics.com/'
    stripUrl = url + 'comic/%s/'
    firstStripUrl = stripUrl % 'page-0-1'
    adult = True

    def starter(self):
        # Set age-gate cookie
        self.session.cookies.set('age_gate', '1', domain='moonlace.darkblueworkshop.com')
        return indirectStarter(self)


class Moonsticks(ParserScraper):
    url = "https://moonsticks.org/"
    imageSearch = "//div[d:class('entry-content')]//img"
    prevSearch = ('//a[@rel="prev"]', "//a[text()='\u00AB Prev']")


class MyLifeWithFel(ParserScraper):
    baseUrl = 'https://www.mylifewithfel.com/'
    stripUrl = baseUrl + 'api/posts/%s'
    firstStripUrl = stripUrl % '1'
    url = firstStripUrl
    namer = joinPathPartsNamer(pageparts=(-1,))
    adult = True

    def starter(self):
        # Retrieve comic metadata from API
        data = self.session.get(self.url)
        data.raise_for_status()
        return self.stripUrl % data.json()['last']['id']

    def getPrevUrl(self, url, data):
        return self.stripUrl % json.loads(data.text_content())['previous']['id']

    def extract_image_urls(self, url, data):
        return [self.baseUrl + json.loads(data.text_content())['post']['image']]


class MynarskiForest(_ParserScraper):
    stripUrl = 'http://mynarskiforest.purrsia.com/xsl%s.htm'
    url = stripUrl % '09_36'
    firstStripUrl = stripUrl % '97_01'
    imageSearch = '//img[not(contains(@src, "arrow"))]'
    prevSearch = '//a[./img[contains(@src, "arrowbk")]]'
    multipleImagesPerStrip = True
    endOfLife = True


class MysteriesOfTheArcana(_ParserScraper):
    url = 'http://mysteriesofthearcana.com/'
    imageSearch = '//div[@id="comic"]//img'
    prevSearch = '//a[@class="navprevious"]'


class MonsterUnderTheBed(WordPressScraper):
    url = 'http://themonsterunderthebed.net/'
    stripUrl = url + '?comic=%s'
    firstStripUrl = stripUrl % 'test-post'
    adult = True