~dosage-dev/dosage/test-mode

« back to all changes in this revision

Viewing changes to dosage/plugins/w.py

  • Committer: ns
  • Date: 2009-12-01 06:47:33 UTC
  • Revision ID: ns@ww1aviationlinks.cjb.net-20091201064733-wqy9o7lggwhd36o3
repairĀ forĀ Lint

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from re import compile, IGNORECASE, DOTALL
 
2
 
 
3
from dosage.helpers import BasicScraper, queryNamer
 
4
 
 
5
 
 
6
class WayfarersMoon(BasicScraper):
 
7
    latestUrl = 'http://www.wayfarersmoon.com/'
 
8
    imageUrl = 'http://www.wayfarersmoon.com/index.php\?page=%s'
 
9
    imageSearch = compile(r'<img src="(/admin.+?)"')
 
10
    prevSearch = compile(r'<a href="(.+?)".+?btn_back.gif')
 
11
    help = 'Index format: nn'
 
12
 
 
13
 
 
14
class WhiteNinja(BasicScraper):
 
15
    latestUrl = 'http://www.whiteninjacomics.com/comics.shtml'
 
16
    imageUrl = 'http://www.whiteninjacomics.com/comics/%s.shtml'
 
17
    imageSearch = compile(r'<img src=(/images/comics/(?!t-).+?\.gif) border=0')
 
18
    prevSearch = compile(r'(/comics/.+?shtml).+?previous')
 
19
    help = 'Index format: s (comic name)'
 
20
 
 
21
 
 
22
class WhyTheLongFace(BasicScraper):
 
23
    latestUrl = 'http://www.absurdnotions.org/'
 
24
    imageUrl = 'http://www.absurdnotions.org/wtlf%s.html'
 
25
    imageSearch = compile(r'<IMG SRC="(lf\d+\..+?)"')
 
26
    prevSearch = compile(r'<A.*?HREF="(wtlf\d+\.html)"><img SRC="nprev\.gif"')
 
27
    help = 'Index format: yyyymm'
 
28
 
 
29
 
 
30
class Wigu(BasicScraper):
 
31
    latestUrl = 'http://www.wigu.com/wigu/'
 
32
    imageUrl = 'http://www.wigu.com/wigu/?date=%s'
 
33
    imageSearch = compile(r'<img src="(strips/\d{8}\..+?)" alt=""')
 
34
    prevSearch = compile(r'<a href="(\?date=\d{8})" class=comic>< PREVIOUS COMIC')
 
35
    help = 'Index format: yyyymmdd'
 
36
 
 
37
 
 
38
class WiguTV(BasicScraper):
 
39
    latestUrl = 'http://jjrowland.com/'
 
40
    imageUrl = 'http://jjrowland.com/archive/%s.html'
 
41
    imageSearch = compile(r'"(/comics/.+?)"')
 
42
    prevSearch = compile(r'nbsp;<a href="(/archive/.+?)".+?previous')
 
43
    help = 'Index format: yyyymmdd'
 
44
 
 
45
class WotNow(BasicScraper):
 
46
    latestUrl = 'http://www.shadowburn.com/wotnow/'
 
47
    imageUrl = 'http://www.shadowburn.com/wotnow/comic.php?comic_id=%s'
 
48
    imageSearch = compile(r'<IMG SRC="(comics/wn\d{4}\..+?)"')
 
49
    prevSearch = compile(r'HREF="(/wotnow/comic.php\?comic_id=\d+)"><IMG SRC="images/b_prev.gif"')
 
50
    help = 'Index format: n (unpadded)'
 
51
 
 
52
 
 
53
class Winter(BasicScraper):
 
54
    latestUrl = 'http://www.wintercomic.com/'
 
55
    imageUrl = 'http://www.wintercomic.com/index.php?strip_id=%s'
 
56
    imageSearch = compile(r'<img src=\'(/index\.php\?do_command=show_strip&strip_id=\d+.+?)\'')
 
57
    prevSearch = compile(r'<a href=[\'"](/?index\.php\?strip_id=\d+)[\'"]><img.+?src=[\'"]\./img/lastpage.gif[\'"]')
 
58
    help = 'Index format: n (unpadded)'
 
59
    namer = queryNamer('strip_id')
 
60
 
 
61
 
 
62
class Wulffmorgenthaler(BasicScraper):
 
63
    latestUrl = 'http://www.wulffmorgenthaler.com/'
 
64
    imageUrl = 'http://www.wulffmorgenthaler.com/Default.aspx?id=%s'
 
65
    imageSearch = compile(r'img id="ctl00_content_Strip1_imgStrip".+?class="strip" src="(striphandler\.ashx\?stripid=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"')
 
66
    prevSearch = compile(r'<a href="(/Default\.aspx\?id=[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})" id="ctl00_content_Strip1_aPrev">')
 
67
    help = 'Index format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (GUID)'
 
68
    namer = queryNamer('stripid')
 
69
 
 
70
 
 
71
def webcomicsNation():
 
72
    class WebcomicsNation(BasicScraper):
 
73
        imageSearch = compile(r'<a name="strip\d*?">.*?<img[^>]+?src="([^"]*?memberimages/.+?)"', IGNORECASE + DOTALL)
 
74
        prevSearch = compile(r'href="([^"]*?whichbutton=prev[^"]*?)"', IGNORECASE)
 
75
        help = 'Index format: nnnn (non-contiguous)'
 
76
 
 
77
        @property
 
78
        def imageUrl(self):
 
79
            return self.baseUrl + '?view=archive&amp;chapter=%s'
 
80
 
 
81
    comics = {
 
82
        'AgnesQuill': 'daveroman/agnes/',
 
83
        'Elvenbaath': 'tdotodot2k/elvenbaath/',
 
84
        'IrrationalFears': 'uvernon/irrationalfears/',
 
85
        'KismetHuntersMoon': 'laylalawlor/huntersmoon/',
 
86
        'SaikoAndLavender': 'gc/saiko/',
 
87
        'MyMuse': 'gc/muse/',
 
88
        'NekkoAndJoruba': 'nekkoandjoruba/nekkoandjoruba/',
 
89
        'JaxEpoch': 'johngreen/quicken/',
 
90
        'QuantumRockOfAges': 'DreamchildNYC/quantum/',
 
91
        }
 
92
 
 
93
    return dict((name, WebcomicsNation.make('WebcomicsNation/' + name, latestUrl='http://www.webcomicsnation.com/' + subpath)) for name, subpath in comics.iteritems())
 
94
 
 
95
globals().update(webcomicsNation())