|
@@ 1502-1524 (lines=23) @@
|
| 1499 |
|
url = 'http://www.overcompensating.com' |
| 1500 |
|
get_url_from_link = join_cls_url_to_href |
| 1501 |
|
|
| 1502 |
|
@classmethod |
| 1503 |
|
def get_first_comic_link(cls): |
| 1504 |
|
"""Get link to first comics.""" |
| 1505 |
|
return get_soup_at_url(cls.url).find('a', href=re.compile('comic=1$')) |
| 1506 |
|
|
| 1507 |
|
@classmethod |
| 1508 |
|
def get_navi_link(cls, last_soup, next_): |
| 1509 |
|
return last_soup.find('a', title='next comic' if next_ else 'go back already') |
| 1510 |
|
|
| 1511 |
|
@classmethod |
| 1512 |
|
def get_comic_info(cls, soup, link): |
| 1513 |
|
"""Get information about a particular comics.""" |
| 1514 |
|
img_src_re = re.compile('^/oc/comics/.*') |
| 1515 |
|
comic_num_re = re.compile('.*comic=([0-9]*)$') |
| 1516 |
|
comic_url = cls.get_url_from_link(link) |
| 1517 |
|
num = int(comic_num_re.match(comic_url).groups()[0]) |
| 1518 |
|
img = soup.find('img', src=img_src_re) |
| 1519 |
|
return { |
| 1520 |
|
'num': num, |
| 1521 |
|
'img': [urljoin_wrapper(comic_url, img['src'])], |
| 1522 |
|
'title': img.get('title') |
| 1523 |
|
} |
| 1524 |
|
|
| 1525 |
|
|
| 1526 |
|
class Oglaf(GenericNavigableComic): |
| 1527 |
|
"""Class to retrieve Oglaf comics.""" |
|
@@ 1978-1999 (lines=22) @@
|
| 1975 |
|
class PoorlyDrawnLines(GenericListableComic): |
| 1976 |
|
"""Class to retrieve Poorly Drawn Lines comics.""" |
| 1977 |
|
# Also on http://pdlcomics.tumblr.com |
| 1978 |
|
name = 'poorlydrawn' |
| 1979 |
|
long_name = 'Poorly Drawn Lines' |
| 1980 |
|
url = 'http://poorlydrawnlines.com' |
| 1981 |
|
get_url_from_archive_element = get_href |
| 1982 |
|
|
| 1983 |
|
@classmethod |
| 1984 |
|
def get_comic_info(cls, soup, link): |
| 1985 |
|
"""Get information about a particular comics.""" |
| 1986 |
|
imgs = soup.find('div', class_='post').find_all('img') |
| 1987 |
|
assert len(imgs) <= 1 |
| 1988 |
|
return { |
| 1989 |
|
'img': [i['src'] for i in imgs], |
| 1990 |
|
'title': imgs[0].get('title', "") if imgs else "", |
| 1991 |
|
} |
| 1992 |
|
|
| 1993 |
|
@classmethod |
| 1994 |
|
def get_archive_elements(cls): |
| 1995 |
|
archive_url = urljoin_wrapper(cls.url, 'archive') |
| 1996 |
|
url_re = re.compile('^%s/comic/.' % cls.url) |
| 1997 |
|
return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
| 1998 |
|
|
| 1999 |
|
|
| 2000 |
|
class LoadingComics(GenericNavigableComic): |
| 2001 |
|
"""Class to retrieve Loading Artist comics.""" |
| 2002 |
|
name = 'loadingartist' |