dosage/dosagelib/plugins/d.py

362 lines
12 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2016-10-28 22:21:41 +00:00
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
2014-01-05 15:50:57 +00:00
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2019 Tobias Gruetzmacher
2012-11-21 20:57:26 +00:00
from __future__ import absolute_import, division, print_function
from re import compile, escape
2012-06-20 19:58:13 +00:00
2015-04-26 10:32:52 +00:00
from ..scraper import _BasicScraper, _ParserScraper
2017-02-13 21:41:17 +00:00
from ..helpers import indirectStarter, bounceStarter, xpath_class
2012-12-04 06:02:40 +00:00
from ..util import tagre
2019-07-13 03:34:47 +00:00
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn
2012-06-20 19:58:13 +00:00
2016-04-29 22:44:18 +00:00
class DamnLol(_ParserScraper):
2013-04-10 16:19:38 +00:00
url = 'http://www.damnlol.com/'
2016-09-29 22:15:45 +00:00
# Classes for next and previous seem to be swapped...
prevSearch = '//a[%s]' % xpath_class("next")
nextSearch = '//a[%s]' % xpath_class("previous")
imageSearch = '//img[@id="post-image"]'
starter = bounceStarter
2013-04-10 16:19:38 +00:00
def namer(self, image_url, page_url):
ext = image_url.rsplit('.', 1)[1]
path = page_url.rsplit('/', 1)[1][:-5]
2013-04-10 16:19:38 +00:00
stripname, number = path.rsplit('-', 1)
return '%s-%s.%s' % (number, stripname, ext)
2012-12-08 20:30:51 +00:00
class Damonk(_BasicScraper):
url = 'http://www.damonk.com/'
stripUrl = url + 'd/%s.html'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '20060522'
2012-12-08 20:30:51 +00:00
imageSearch = compile(tagre("img", "src", r'(/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(/d/\d+\.html)') +
tagre("img", "src", r'/images/previous_day\.gif'))
2012-12-08 20:30:51 +00:00
help = 'Index format: yyyymmdd'
2017-05-14 22:27:28 +00:00
class DangerouslyChloe(_ComicControlScraper):
url = 'http://www.dangerouslychloe.com/'
2017-05-14 22:27:28 +00:00
firstStripUrl = url + 'strips-dc/Chapter_1_-_That_damned_girl'
2019-07-13 03:34:47 +00:00
class DarkWhite(_WordPressScraper):
url = 'https://www.darkwhitecomic.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'chapter-1-sleep'
2013-08-19 17:18:02 +00:00
class DarthsAndDroids(_BasicScraper):
url = 'http://www.darthsanddroids.net/'
stripUrl = url + 'episodes/%s.html'
firstStripUrl = stripUrl % '0001'
prevSearch = compile(tagre("a", "href", r'(/episodes/\d\d\d\d.html)') +
'<PREVIOUS')
2013-08-19 17:18:02 +00:00
imageSearch = compile(tagre("img", "src", r'(/comics/darths\d\d\d\d\.jpg)'))
2017-04-15 23:06:41 +00:00
class DasLebenIstKeinPonyhof(_WPNaviIn):
2013-03-21 17:33:16 +00:00
url = 'http://sarahburrini.com/wordpress/'
firstStripUrl = url + 'comic/mein-erster-webcomic/'
2013-03-21 17:33:16 +00:00
lang = 'de'
class DeadWinter(_BasicScraper):
url = 'http://deadwinter.cc/'
stripUrl = url + 'page/%s'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r"(/static/page/strip/\d+[^']+)", quote="'"))
prevSearch = compile(tagre("a", "href", r'(/page/\d+)') + "Previous")
help = 'Index format: number'
2017-09-19 10:36:19 +00:00
class Deathbulge(_BasicScraper):
url = 'http://www.deathbulge.com/api/comics'
2017-11-17 08:49:47 +00:00
imageSearch = compile(r"(/images/comics/[^\.]+\.jpg)")
2017-09-19 10:36:19 +00:00
prevSearch = compile(r'"previous":(\d+),')
firstStripUrl = url + '/1'
2018-05-22 22:54:40 +00:00
2017-09-19 10:36:19 +00:00
def getPrevUrl(self, url, data):
if data[1] == self.url:
data = (data[0], data[1] + '/')
return _BasicScraper.getPrevUrl(self, url, data)
2012-06-20 19:58:13 +00:00
class DeepFried(_BasicScraper):
url = 'http://www.whatisdeepfried.com/'
rurl = escape(url)
2013-04-10 21:57:09 +00:00
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2001/09/16/new-world-out-of-order'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev"))
2013-04-10 21:57:09 +00:00
help = 'Index format: none'
2012-06-20 19:58:13 +00:00
2019-07-14 08:12:19 +00:00
class DeerMe(_ParserScraper):
url = 'http://deerme.net/'
stripUrl = url + 'comics/%s'
firstStripUrl = stripUrl % '1'
imageSearch = ('//img[@id="comicimage"]', '//img[@id="latestcomicimage"]')
prevSearch = '//a[@rel="prev"]'
nextSearch = '//a[@rel="next"]'
starter = bounceStarter
def namer(self, imageUrl, pageUrl):
return pageUrl.rsplit('/', 1)[-1] + '.' + imageUrl.rsplit('.', 1)[-1]
2019-07-13 09:15:14 +00:00
class Delve(_WordPressScraper):
url = 'http://thisis.delvecomic.com/NewWP/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'in-too-deep'
adult = True
maxLen = len('episode999')
def namer(self, imageUrl, pageUrl):
# Fix inconsistent filenames
filename = imageUrl.rsplit('/', 1)[-1].rsplit('?', 1)[0]
if (pageUrl == self.stripUrl % 'engagement' or
pageUrl == self.stripUrl % 'losing-it'):
self.maxLen = self.maxLen - 1
if ('episode' in filename and
len(filename) - len('.jpg') > self.maxLen and
filename[self.maxLen] != '-'):
filename = filename[:self.maxLen] + '-' + filename[self.maxLen:]
return filename
2015-05-26 10:59:25 +00:00
class DemolitionSquad(_ParserScraper):
2013-03-19 19:45:59 +00:00
url = 'http://www.demolitionsquad.de/'
2014-01-20 18:01:47 +00:00
stripUrl = url + '?comicbeitrag=%s'
firstStripUrl = stripUrl % '181'
2015-05-26 10:59:25 +00:00
imageSearch = '//img[contains(@src,"uploads/pics/")]'
prevSearch = '//img[@name="zuruck"]/..'
2014-01-20 18:01:47 +00:00
help = 'Index format: number'
2013-03-19 19:45:59 +00:00
lang = 'de'
2016-04-29 22:44:18 +00:00
class DerTodUndDasMaedchen(_ParserScraper):
2013-03-21 17:33:16 +00:00
url = 'http://www.cartoontomb.de/deutsch/tod2.php'
stripUrl = url + '?bild=%s.jpg'
firstStripUrl = stripUrl % '00_01_01'
2016-04-29 22:44:18 +00:00
imageSearch = '//img[contains(@src, "images/tod/teil2")]'
prevSearch = u'//a[text()="zur\u00FCck"]'
2013-03-21 17:33:16 +00:00
help = 'Index format: nn_nn_nn'
lang = 'de'
2014-02-18 20:00:19 +00:00
class DieFruehreifen(_BasicScraper):
url = 'http://www.die-fruehreifen.de/index.php'
stripUrl = url + '?id=%s&order=DESC'
firstStripUrl = stripUrl % '1'
2014-07-31 19:18:15 +00:00
imageSearch = compile(tagre("img", "src", r'([^"]*/strips/[Ff]rueh_?[Ss]trip_\d+.jpg)'))
prevSearch = compile(tagre("a", "href", r"(index\.php\?id=\d+&order=DESC)") +
tagre("img", "id", r"naechster"))
2014-02-18 20:00:19 +00:00
help = 'Index format: n (unpadded)'
lang = 'de'
2016-04-29 22:44:18 +00:00
class DieselSweeties(_ParserScraper):
2016-05-05 08:12:03 +00:00
url = 'http://dieselsweeties.com/'
2016-09-29 22:15:45 +00:00
stripUrl = url + 'ics/%s'
2016-04-29 22:44:18 +00:00
firstStripUrl = stripUrl % '1'
imageSearch = '//img[@class="xomic"]'
prevSearch = '//div[@id="prev"]//a[contains(text(), "previous")]'
2016-05-16 21:16:29 +00:00
latestSearch = prevSearch
starter = indirectStarter
2016-04-29 22:44:18 +00:00
help = 'Index format: n (unpadded)'
class DieselSweetiesOld(_ParserScraper):
2016-05-05 08:12:03 +00:00
url = 'http://dieselsweeties.com/archive/'
2016-04-29 22:44:18 +00:00
stripUrl = url + '%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2016-04-29 22:44:18 +00:00
imageSearch = '//img[contains(@src, "/hstrips/")]'
prevSearch = '//a[contains(@title, "previous")]'
2013-03-06 19:21:10 +00:00
help = 'Index format: n (unpadded)'
2016-04-29 22:44:18 +00:00
endOfLife = True
def starter(self):
return self.stripUrl % '4000'
2013-03-06 19:21:10 +00:00
def namer(self, image_url, page_url):
index = int(image_url.split('/')[-1].split('.')[0])
return 'sw%02d' % index
2013-03-06 19:21:10 +00:00
2016-05-15 23:21:23 +00:00
class Dilbert(_ParserScraper):
2013-03-06 19:21:10 +00:00
url = 'http://dilbert.com/'
2016-05-05 08:12:03 +00:00
stripUrl = url + 'strip/%s'
2013-03-19 19:45:18 +00:00
firstStripUrl = stripUrl % '1989-04-16'
starter = indirectStarter
2016-05-15 23:21:23 +00:00
prevSearch = '//div[%s]/a' % xpath_class('nav-left')
imageSearch = '//img[%s]' % xpath_class('img-comic')
latestSearch = '//a[@class="img-comic-link"]'
2013-03-06 19:21:10 +00:00
help = 'Index format: yyyy-mm-dd'
2013-03-06 19:21:20 +00:00
def namer(self, image_url, page_url):
name = page_url.rsplit("/", 1)[1]
2015-01-16 18:05:53 +00:00
return "%s" % name
2013-03-06 19:21:10 +00:00
2019-07-06 19:49:40 +00:00
class DocRat(_ParserScraper):
url = 'http://www.docrat.com.au/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'begin-with-eye-contact'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
def namer(self, imageUrl, pageUrl):
# Fix inconsistent filenames
filename = imageUrl.rsplit('/', 1)[-1].rsplit('?', 1)[0]
filename = filename.replace('2006-08-01', 'DR0027')
filename = filename.replace('2006-07-31', 'DR0026')
return filename
2016-10-31 05:57:47 +00:00
class DoemainOfOurOwn(_ParserScraper):
url = 'http://www.doemain.com/'
stripUrl = url + 'index.cgi/%s'
2016-10-31 05:57:47 +00:00
imageSearch = '//td/img[contains(@src, "/strips/")]'
prevSearch = '//a[img[@alt="Previous Strip"]]'
endOfLife = True
2012-06-20 19:58:13 +00:00
help = 'Index format: yyyy-mm-dd'
2019-07-13 03:41:06 +00:00
class DoghouseDiaries(_ParserScraper):
2013-03-15 06:04:19 +00:00
url = 'http://thedoghousediaries.com/'
stripUrl = url + '%s'
2015-04-15 16:51:45 +00:00
firstStripUrl = stripUrl % '34'
2019-07-13 03:41:06 +00:00
imageSearch = '//img[@class="imgcomic"]'
textSearch = imageSearch + '/@title'
prevSearch = '//a[@id="previouslink"]'
nextSearch = '//a[@id="nextlink"]'
starter = bounceStarter
2013-03-15 06:04:19 +00:00
help = 'Index format: number'
2019-07-13 03:41:06 +00:00
def namer(self, imageUrl, pageUrl):
return pageUrl.rsplit('/', 1)[-1] + '.' + imageUrl.rsplit('.', 1)[-1]
2013-03-15 06:04:19 +00:00
2019-06-13 06:14:39 +00:00
class DominicDeegan(_ParserScraper):
2013-03-06 19:21:10 +00:00
url = 'http://www.dominic-deegan.com/'
2019-06-13 06:14:39 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % '0001-20020521'
imageSearch = '//img[contains(@class, "wp-post-image")]'
prevSearch = '//a[@title="Prev"]'
endOfLife = True
help = 'Index format: ####-yyyymmdd'
2013-03-06 19:21:10 +00:00
2016-10-31 05:57:47 +00:00
class DorkTower(_ParserScraper):
2013-03-06 19:21:10 +00:00
url = 'http://www.dorktower.com/'
2016-10-31 05:57:47 +00:00
firstStripUrl = url + '1997/01/01/shadis-magazine-strip-1/'
imageSearch = '//div[%s]//a/img' % xpath_class('entry-content')
prevSearch = '//a[%s][text()="Previous"]' % xpath_class('btn')
2013-03-06 19:21:10 +00:00
class DoomsdayMyDear(_ParserScraper):
url = 'http://doomsdaymydear.com/'
imageSearch = '//img[{}]'.format(xpath_class('attachment-full'))
prevSearch = '//a[{}]'.format(xpath_class('previous-webcomic-link'))
2012-06-20 19:58:13 +00:00
class Dracula(_BasicScraper):
url = 'http://draculacomic.net/'
stripUrl = url + 'comic.php?comicID=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '0'
imageSearch = compile(tagre("img", "src", r'(comics/[^"]+)'))
2012-06-20 19:58:13 +00:00
prevSearch = compile(r'&nbsp;<a class="archivelink" href="(.+?)">&laquo; Prev</a>')
help = 'Index format: nnn'
2019-06-20 04:39:19 +00:00
class DreamKeepers(_ParserScraper):
url = 'http://www.dreamkeeperscomic.com/GNSaga.php'
stripUrl = url + '?pg=%s'
firstStripUrl = stripUrl % '1'
imageSearch = '//img[contains(@src, "GNSagapages")]'
prevSearch = '//a[@id="prev"]'
help = 'Index format: n'
2016-09-29 22:15:45 +00:00
class DreamKeepersPrelude(_ParserScraper):
url = 'http://www.dreamkeeperscomic.com/Prelude.php'
stripUrl = url + '?pg=%s'
2019-06-20 04:39:19 +00:00
firstStripUrl = stripUrl % '0001'
2016-09-29 22:15:45 +00:00
imageSearch = '//div[@class="Preludecomic"]/table//a/img'
prevSearch = '//a[@id="prev"]'
2012-06-20 19:58:13 +00:00
help = 'Index format: n'
2017-02-12 01:16:38 +00:00
class DresdenCodak(_ParserScraper):
url = 'http://dresdencodak.com/'
2017-02-12 01:16:38 +00:00
startUrl = url + 'cat/comic/'
2013-04-10 21:57:09 +00:00
firstStripUrl = url + '2007/02/08/pom/'
2017-05-14 22:27:28 +00:00
imageSearch = '//section[%s]//img[%s]' % (
xpath_class('entry-content'), xpath_class('aligncenter'))
2017-05-14 22:27:28 +00:00
prevSearch = '//a[img[contains(@src, "prev")]]'
2017-02-12 01:16:38 +00:00
latestSearch = '//a[%s]' % xpath_class('tc-grid-bg-link')
starter = indirectStarter
2012-06-20 19:58:13 +00:00
2017-02-12 01:16:38 +00:00
# Blog and comic are mixed...
def shouldSkipUrl(self, url, data):
return not data.xpath(self.imageSearch)
2012-11-26 06:13:32 +00:00
2013-04-10 21:57:09 +00:00
class DrFun(_BasicScraper):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://www.ibiblio.org/Dave/'
url = baseUrl + 'ar00502.htm'
stripUrl = baseUrl + 'ar%s.htm'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '00001'
imageSearch = compile(tagre("a", "href", r'(Dr-Fun/df\d+/df[^"]+)'))
multipleImagesPerStrip = True
prevSearch = compile(tagre("a", "href", r'([^"]+)') + 'Previous Week,')
help = 'Index format: nnnnn'
2013-04-29 18:29:56 +00:00
endOfLife = True
2013-04-10 21:57:09 +00:00
2015-01-26 09:21:24 +00:00
class Drive(_BasicScraper):
url = 'http://www.drivecomic.com/'
rurl = escape(url)
stripUrl = url + 'archive/%s.html'
firstStripUrl = stripUrl % '090815'
imageSearch = compile(tagre("img", "src", r'(http://cdn\.drivecomic\.com/strips/main/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(%sarchive/\d+\.html)' % rurl) + "Previous")
help = 'Index format: yymmdd'
class DrMcNinja(_ParserScraper):
2013-03-25 18:47:44 +00:00
url = 'http://drmcninja.com/'
stripUrl = url + 'archives/comic/%s/'
firstStripUrl = stripUrl % '0p1'
css = True
imageSearch = 'div#comic img'
prevSearch = 'a.prev'
help = 'Index format: {episode}p{page}'
2013-03-25 18:47:44 +00:00
2013-03-06 19:21:10 +00:00
class Drowtales(_BasicScraper):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://www.drowtales.com/'
rurl = escape(baseUrl)
url = baseUrl + 'mainarchive.php'
2013-03-06 19:21:10 +00:00
stripUrl = url + '?sid=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '4192'
2013-04-11 16:27:43 +00:00
imageSearch = (
2017-05-14 22:27:28 +00:00
compile(tagre("img", "src", r'((%s)?mainarchive/[^"]+)' % rurl)),
2013-04-11 16:27:43 +00:00
compile(r'background-image:url\((mainarchive/[^\)]+center\.jpg)'),
)
2013-03-06 19:21:10 +00:00
prevSearch = compile(tagre("a", "href", r'(\?sid=\d+)', before="link_prev_top"))
help = 'Index format: number'
2013-02-06 21:08:36 +00:00
class DumbingOfAge(_BasicScraper):
2013-02-06 21:08:36 +00:00
url = 'http://www.dumbingofage.com/'
rurl = escape(url)
2013-02-06 21:08:36 +00:00
stripUrl = url + '%s/'
prevSearch = compile(tagre("a", "href", r'(%s\d+/[^"]+)' % rurl, after="prev"))
imageSearch = compile(tagre("img", "src", r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
2013-02-06 21:08:36 +00:00
help = 'Index format: yyyy/comic/book-num/seriesname/stripname'