|
@@ 3746-3777 (lines=32) @@
|
| 3743 |
|
} |
| 3744 |
|
|
| 3745 |
|
|
| 3746 |
|
class GenericSquareSpace(GenericNavigableComic): |
| 3747 |
|
"""Generic class to retrieve comics using SquareSpace.""" |
| 3748 |
|
_categories = ('SQUARESPACE', ) |
| 3749 |
|
get_url_from_link = join_cls_url_to_href |
| 3750 |
|
get_first_comic_link = simulate_first_link |
| 3751 |
|
|
| 3752 |
|
@classmethod |
| 3753 |
|
def get_navi_link(cls, last_soup, next_): |
| 3754 |
|
"""Get link to next or previous comic.""" |
| 3755 |
|
return last_soup.find('a', id='prevLink' if next_ else 'nextLink') |
| 3756 |
|
|
| 3757 |
|
@classmethod |
| 3758 |
|
def get_images(cls, soup): |
| 3759 |
|
"""Get image URLs for a comic.""" |
| 3760 |
|
raise NotImplementedError |
| 3761 |
|
|
| 3762 |
|
@classmethod |
| 3763 |
|
def get_comic_info(cls, soup, link): |
| 3764 |
|
"""Get information about a particular comics.""" |
| 3765 |
|
title = soup.find('meta', property='og:title')['content'] |
| 3766 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 3767 |
|
date_str = soup.find('time', itemprop='datePublished')["datetime"] |
| 3768 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 3769 |
|
author = soup.find('a', rel='author').string |
| 3770 |
|
return { |
| 3771 |
|
'title': title, |
| 3772 |
|
'img': cls.get_images(soup), |
| 3773 |
|
'month': day.month, |
| 3774 |
|
'year': day.year, |
| 3775 |
|
'day': day.day, |
| 3776 |
|
'author': author, |
| 3777 |
|
'description': desc, |
| 3778 |
|
} |
| 3779 |
|
|
| 3780 |
|
|
|
@@ 3594-3623 (lines=30) @@
|
| 3591 |
|
} |
| 3592 |
|
|
| 3593 |
|
|
| 3594 |
|
class ConsoliaComics(GenericNavigableComic): |
| 3595 |
|
"""Class to retrieve Consolia comics.""" |
| 3596 |
|
name = 'consolia' |
| 3597 |
|
long_name = 'consolia' |
| 3598 |
|
url = 'https://consolia-comic.com' |
| 3599 |
|
get_url_from_link = join_cls_url_to_href |
| 3600 |
|
|
| 3601 |
|
@classmethod |
| 3602 |
|
def get_first_comic_link(cls): |
| 3603 |
|
"""Get link to first comics.""" |
| 3604 |
|
return get_soup_at_url(cls.url).find('a', class_='first') |
| 3605 |
|
|
| 3606 |
|
@classmethod |
| 3607 |
|
def get_navi_link(cls, last_soup, next_): |
| 3608 |
|
"""Get link to next or previous comic.""" |
| 3609 |
|
return last_soup.find('a', class_='next' if next_ else 'prev') |
| 3610 |
|
|
| 3611 |
|
@classmethod |
| 3612 |
|
def get_comic_info(cls, soup, link): |
| 3613 |
|
"""Get information about a particular comics.""" |
| 3614 |
|
title = soup.find('meta', property='og:title')['content'] |
| 3615 |
|
date_str = soup.find('time')["datetime"] |
| 3616 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 3617 |
|
imgs = soup.find_all('meta', property='og:image') |
| 3618 |
|
return { |
| 3619 |
|
'title': title, |
| 3620 |
|
'img': [i['content'] for i in imgs], |
| 3621 |
|
'day': day.day, |
| 3622 |
|
'month': day.month, |
| 3623 |
|
'year': day.year, |
| 3624 |
|
} |
| 3625 |
|
|
| 3626 |
|
|
|
@@ 3413-3441 (lines=29) @@
|
| 3410 |
|
} |
| 3411 |
|
|
| 3412 |
|
|
| 3413 |
|
class PomComics(GenericNavigableComic): |
| 3414 |
|
"""Class to retrieve PomComics.""" |
| 3415 |
|
name = 'pom' |
| 3416 |
|
long_name = 'Pom Comics / Piece of Me' |
| 3417 |
|
url = 'http://www.pomcomic.com' |
| 3418 |
|
get_url_from_link = join_cls_url_to_href |
| 3419 |
|
|
| 3420 |
|
@classmethod |
| 3421 |
|
def get_first_comic_link(cls): |
| 3422 |
|
"""Get link to first comics.""" |
| 3423 |
|
return get_soup_at_url(cls.url).find('a', class_='btn-first') |
| 3424 |
|
|
| 3425 |
|
@classmethod |
| 3426 |
|
def get_navi_link(cls, last_soup, next_): |
| 3427 |
|
"""Get link to next or previous comic.""" |
| 3428 |
|
return last_soup.find('a', class_='btn-next' if next_ else 'btn-prev') |
| 3429 |
|
|
| 3430 |
|
@classmethod |
| 3431 |
|
def get_comic_info(cls, soup, link): |
| 3432 |
|
"""Get information about a particular comics.""" |
| 3433 |
|
title = soup.find('h1').string |
| 3434 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 3435 |
|
tags = soup.find('meta', attrs={'name': 'keywords'})['content'] |
| 3436 |
|
imgs = soup.find('div', class_='comic').find_all('img') |
| 3437 |
|
return { |
| 3438 |
|
'title': title, |
| 3439 |
|
'desc': desc, |
| 3440 |
|
'tags': tags, |
| 3441 |
|
'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
| 3442 |
|
} |
| 3443 |
|
|
| 3444 |
|
|