dosage/dosagelib/plugins/v.py

56 lines
1.8 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2016-10-29 00:21:41 +02:00
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
2014-01-05 16:50:57 +01:00
# Copyright (C) 2012-2014 Bastian Kleineidam
2017-02-12 20:29:57 +01:00
# Copyright (C) 2015-2017 Tobias Gruetzmacher
2012-11-21 21:57:26 +01:00
from __future__ import absolute_import, division, print_function
2012-11-26 07:13:32 +01:00
from re import compile
2012-06-20 21:58:13 +02:00
2016-10-31 06:57:47 +01:00
from ..scraper import _BasicScraper, _ParserScraper
2017-02-13 22:41:17 +01:00
from ..helpers import indirectStarter, xpath_class
2012-11-26 07:13:32 +01:00
from ..util import tagre
2012-06-20 21:58:13 +02:00
2012-12-02 18:35:06 +01:00
class VGCats(_BasicScraper):
url = 'http://www.vgcats.com/comics/'
stripUrl = url + '?strip_id=%s'
2013-04-10 23:57:09 +02:00
firstStripUrl = stripUrl % '0'
2012-12-02 18:35:06 +01:00
imageSearch = compile(tagre("img", "src", r'(images/\d{6}\.[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(\?strip_id=\d+)') +
tagre("img", "src", r"back\.gif"))
2012-06-20 21:58:13 +02:00
help = 'Index format: n (unpadded)'
2012-12-02 18:35:06 +01:00
class VGCatsAdventure(VGCats):
2012-06-20 21:58:13 +02:00
name = 'VGCats/Adventure'
url = 'http://www.vgcats.com/ffxi/'
stripUrl = url + '?strip_id=%s'
2012-06-20 21:58:13 +02:00
class VGCatsSuper(VGCats):
name = 'VGCats/Super'
url = 'http://www.vgcats.com/super/'
stripUrl = url + '?strip_id=%s'
2012-12-08 21:30:51 +01:00
class VictimsOfTheSystem(_BasicScraper):
url = 'http://www.votscomic.com/'
stripUrl = url + '?id=%s.jpg'
2013-04-10 23:57:09 +02:00
firstStripUrl = stripUrl % '070103-002452'
2012-12-08 21:30:51 +01:00
imageSearch = compile(tagre("img", "src", r'(comicpro/strips/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(\?id=\d+-\d+\.jpg)') +
"Previous")
2012-12-08 21:30:51 +01:00
help = 'Index format: nnn-nnn'
2016-10-31 06:57:47 +01:00
class ViiviJaWagner(_ParserScraper):
url = 'http://www.hs.fi/viivijawagner/'
2017-02-12 20:29:57 +01:00
imageSearch = '//meta[@property="og:image"]/@content'
prevSearch = '//a[%s]' % xpath_class('prev')
latestSearch = '//div[%s]//a' % xpath_class('cartoon-content')
starter = indirectStarter
2015-04-18 22:45:13 +02:00
lang = 'fi'
2012-12-08 00:45:18 +01:00
def namer(self, image_url, page_url):
2017-02-12 20:29:57 +01:00
return page_url.rsplit('-', 1)[1].split('.')[0]