|
@@ 3425-3454 (lines=30) @@
|
| 3422 |
|
} |
| 3423 |
|
|
| 3424 |
|
|
| 3425 |
|
class ConsoliaComics(GenericNavigableComic): |
| 3426 |
|
"""Class to retrieve Consolia comics.""" |
| 3427 |
|
name = 'consolia' |
| 3428 |
|
long_name = 'consolia' |
| 3429 |
|
url = 'https://consolia-comic.com' |
| 3430 |
|
get_url_from_link = join_cls_url_to_href |
| 3431 |
|
|
| 3432 |
|
@classmethod |
| 3433 |
|
def get_first_comic_link(cls): |
| 3434 |
|
"""Get link to first comics.""" |
| 3435 |
|
return get_soup_at_url(cls.url).find('a', class_='first') |
| 3436 |
|
|
| 3437 |
|
@classmethod |
| 3438 |
|
def get_navi_link(cls, last_soup, next_): |
| 3439 |
|
"""Get link to next or previous comic.""" |
| 3440 |
|
return last_soup.find('a', class_='next' if next_ else 'prev') |
| 3441 |
|
|
| 3442 |
|
@classmethod |
| 3443 |
|
def get_comic_info(cls, soup, link): |
| 3444 |
|
"""Get information about a particular comics.""" |
| 3445 |
|
title = soup.find('meta', property='og:title')['content'] |
| 3446 |
|
date_str = soup.find('time')["datetime"] |
| 3447 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 3448 |
|
imgs = soup.find_all('meta', property='og:image') |
| 3449 |
|
return { |
| 3450 |
|
'title': title, |
| 3451 |
|
'img': [i['content'] for i in imgs], |
| 3452 |
|
'day': day.day, |
| 3453 |
|
'month': day.month, |
| 3454 |
|
'year': day.year, |
| 3455 |
|
} |
| 3456 |
|
|
| 3457 |
|
|
|
@@ 3272-3300 (lines=29) @@
|
| 3269 |
|
} |
| 3270 |
|
|
| 3271 |
|
|
| 3272 |
|
class PomComics(GenericNavigableComic): |
| 3273 |
|
"""Class to retrieve PomComics.""" |
| 3274 |
|
name = 'pom' |
| 3275 |
|
long_name = 'Pom Comics / Piece of Me' |
| 3276 |
|
url = 'http://www.pomcomic.com' |
| 3277 |
|
get_url_from_link = join_cls_url_to_href |
| 3278 |
|
|
| 3279 |
|
@classmethod |
| 3280 |
|
def get_first_comic_link(cls): |
| 3281 |
|
"""Get link to first comics.""" |
| 3282 |
|
return get_soup_at_url(cls.url).find('a', class_='btn-first') |
| 3283 |
|
|
| 3284 |
|
@classmethod |
| 3285 |
|
def get_navi_link(cls, last_soup, next_): |
| 3286 |
|
"""Get link to next or previous comic.""" |
| 3287 |
|
return last_soup.find('a', class_='btn-next' if next_ else 'btn-prev') |
| 3288 |
|
|
| 3289 |
|
@classmethod |
| 3290 |
|
def get_comic_info(cls, soup, link): |
| 3291 |
|
"""Get information about a particular comics.""" |
| 3292 |
|
title = soup.find('h1').string |
| 3293 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 3294 |
|
tags = soup.find('meta', attrs={'name': 'keywords'})['content'] |
| 3295 |
|
imgs = soup.find('div', class_='comic').find_all('img') |
| 3296 |
|
return { |
| 3297 |
|
'title': title, |
| 3298 |
|
'desc': desc, |
| 3299 |
|
'tags': tags, |
| 3300 |
|
'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
| 3301 |
|
} |
| 3302 |
|
|
| 3303 |
|
|