From 8b99b5905640c996ef74e13c27e2dc878e7a9a71 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 10 Apr 2013 18:19:38 +0200 Subject: [PATCH] Added DamnLol --- doc/changelog.txt | 2 +- dosagelib/plugins/d.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 3f9f456f6..26825f347 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,7 +1,7 @@ Dosage 2.0 (released xx.xx.2013) Features: -- comics: Added ExtraOrdinary, GoblinsComic, RealmOfAtland, Science, +- comics: Added DamnLol, ExtraOrdinary, GoblinsComic, RealmOfAtland, Science, SnowFlakes, StuffNoOneToldMe, WebDesignerCOTW and ZenPencils. - comics: Added the --vote option to vote for popular comics. diff --git a/dosagelib/plugins/d.py b/dosagelib/plugins/d.py index cfe245238..fd356ae32 100644 --- a/dosagelib/plugins/d.py +++ b/dosagelib/plugins/d.py @@ -19,6 +19,28 @@ class DailyDose(_BasicScraper): help = 'Index format: stripname' +class DamnLol(_BasicScraper): + url = 'http://www.damnlol.com/' + rurl = escape(url) + stripUrl = url + '%s.html' + prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev")) + imageSearch = ( + compile(tagre("img", "src", r'(%si/[^"]+)' % rurl)), + compile(tagre("img", "src", r'(%spics/[^"]+)' % rurl)), + ) + help = 'Index format: stripname-number' + description = 'Funny pictures from the internet. Thousands of them.' + starter = bounceStarter(url, + compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="next"))) + + @classmethod + def namer(cls, imageUrl, pageUrl): + ext = imageUrl.rsplit('.', 1)[1] + path = pageUrl.rsplit('/', 1)[1][:-5] + stripname, number = path.rsplit('-', 1) + return '%s-%s.%s' % (number, stripname, ext) + + class Damonk(_BasicScraper): url = 'http://www.damonk.com/' stripUrl = url + 'd/%s.html'