|
@@ 3693-3724 (lines=32) @@
|
| 3690 |
|
class GenericSquareSpace(GenericNavigableComic): |
| 3691 |
|
"""Generic class to retrieve comics using SquareSpace.""" |
| 3692 |
|
_categories = ('SQUARESPACE', ) |
| 3693 |
|
get_url_from_link = join_cls_url_to_href |
| 3694 |
|
get_first_comic_link = simulate_first_link |
| 3695 |
|
|
| 3696 |
|
@classmethod |
| 3697 |
|
def get_navi_link(cls, last_soup, next_): |
| 3698 |
|
"""Get link to next or previous comic.""" |
| 3699 |
|
return last_soup.find('a', id='prevLink' if next_ else 'nextLink') |
| 3700 |
|
|
| 3701 |
|
@classmethod |
| 3702 |
|
def get_images(cls, soup): |
| 3703 |
|
"""Get image URLs for a comic.""" |
| 3704 |
|
raise NotImplementedError |
| 3705 |
|
|
| 3706 |
|
@classmethod |
| 3707 |
|
def get_comic_info(cls, soup, link): |
| 3708 |
|
"""Get information about a particular comics.""" |
| 3709 |
|
title = soup.find('meta', property='og:title')['content'] |
| 3710 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 3711 |
|
date_str = soup.find('time', itemprop='datePublished')["datetime"] |
| 3712 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 3713 |
|
author = soup.find('a', rel='author').string |
| 3714 |
|
return { |
| 3715 |
|
'title': title, |
| 3716 |
|
'img': cls.get_images(soup), |
| 3717 |
|
'month': day.month, |
| 3718 |
|
'year': day.year, |
| 3719 |
|
'day': day.day, |
| 3720 |
|
'author': author, |
| 3721 |
|
'description': desc, |
| 3722 |
|
} |
| 3723 |
|
|
| 3724 |
|
|
| 3725 |
|
class AtRandomComics(GenericSquareSpace): |
| 3726 |
|
"""Class to retrieve At Random Comics.""" |
| 3727 |
|
name = 'atrandom' |
|
@@ 3541-3570 (lines=30) @@
|
| 3538 |
|
class ConsoliaComics(GenericNavigableComic): |
| 3539 |
|
"""Class to retrieve Consolia comics.""" |
| 3540 |
|
name = 'consolia' |
| 3541 |
|
long_name = 'consolia' |
| 3542 |
|
url = 'https://consolia-comic.com' |
| 3543 |
|
get_url_from_link = join_cls_url_to_href |
| 3544 |
|
|
| 3545 |
|
@classmethod |
| 3546 |
|
def get_first_comic_link(cls): |
| 3547 |
|
"""Get link to first comics.""" |
| 3548 |
|
return get_soup_at_url(cls.url).find('a', class_='first') |
| 3549 |
|
|
| 3550 |
|
@classmethod |
| 3551 |
|
def get_navi_link(cls, last_soup, next_): |
| 3552 |
|
"""Get link to next or previous comic.""" |
| 3553 |
|
return last_soup.find('a', class_='next' if next_ else 'prev') |
| 3554 |
|
|
| 3555 |
|
@classmethod |
| 3556 |
|
def get_comic_info(cls, soup, link): |
| 3557 |
|
"""Get information about a particular comics.""" |
| 3558 |
|
title = soup.find('meta', property='og:title')['content'] |
| 3559 |
|
date_str = soup.find('time')["datetime"] |
| 3560 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 3561 |
|
imgs = soup.find_all('meta', property='og:image') |
| 3562 |
|
return { |
| 3563 |
|
'title': title, |
| 3564 |
|
'img': [i['content'] for i in imgs], |
| 3565 |
|
'day': day.day, |
| 3566 |
|
'month': day.month, |
| 3567 |
|
'year': day.year, |
| 3568 |
|
} |
| 3569 |
|
|
| 3570 |
|
|
| 3571 |
|
class GenericBlogspotComic(GenericNavigableComic): |
| 3572 |
|
"""Generic class to retrieve comics from Blogspot.""" |
| 3573 |
|
get_first_comic_link = simulate_first_link |
|
@@ 3360-3388 (lines=29) @@
|
| 3357 |
|
class PomComics(GenericNavigableComic): |
| 3358 |
|
"""Class to retrieve PomComics.""" |
| 3359 |
|
name = 'pom' |
| 3360 |
|
long_name = 'Pom Comics / Piece of Me' |
| 3361 |
|
url = 'http://www.pomcomic.com' |
| 3362 |
|
get_url_from_link = join_cls_url_to_href |
| 3363 |
|
|
| 3364 |
|
@classmethod |
| 3365 |
|
def get_first_comic_link(cls): |
| 3366 |
|
"""Get link to first comics.""" |
| 3367 |
|
return get_soup_at_url(cls.url).find('a', class_='btn-first') |
| 3368 |
|
|
| 3369 |
|
@classmethod |
| 3370 |
|
def get_navi_link(cls, last_soup, next_): |
| 3371 |
|
"""Get link to next or previous comic.""" |
| 3372 |
|
return last_soup.find('a', class_='btn-next' if next_ else 'btn-prev') |
| 3373 |
|
|
| 3374 |
|
@classmethod |
| 3375 |
|
def get_comic_info(cls, soup, link): |
| 3376 |
|
"""Get information about a particular comics.""" |
| 3377 |
|
title = soup.find('h1').string |
| 3378 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 3379 |
|
tags = soup.find('meta', attrs={'name': 'keywords'})['content'] |
| 3380 |
|
imgs = soup.find('div', class_='comic').find_all('img') |
| 3381 |
|
return { |
| 3382 |
|
'title': title, |
| 3383 |
|
'desc': desc, |
| 3384 |
|
'tags': tags, |
| 3385 |
|
'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
| 3386 |
|
} |
| 3387 |
|
|
| 3388 |
|
|
| 3389 |
|
class CubeDrone(GenericComicNotWorking, GenericNavigableComic): # Website has changed |
| 3390 |
|
"""Class to retrieve Cube Drone comics.""" |
| 3391 |
|
name = 'cubedrone' |