|
@@ 3340-3369 (lines=30) @@
|
| 3337 |
|
} |
| 3338 |
|
|
| 3339 |
|
|
| 3340 |
|
class ConsoliaComics(GenericNavigableComic): |
| 3341 |
|
"""Class to retrieve Consolia comics.""" |
| 3342 |
|
name = 'consolia' |
| 3343 |
|
long_name = 'consolia' |
| 3344 |
|
url = 'https://consolia-comic.com' |
| 3345 |
|
get_url_from_link = join_cls_url_to_href |
| 3346 |
|
|
| 3347 |
|
@classmethod |
| 3348 |
|
def get_first_comic_link(cls): |
| 3349 |
|
"""Get link to first comics.""" |
| 3350 |
|
return get_soup_at_url(cls.url).find('a', class_='first') |
| 3351 |
|
|
| 3352 |
|
@classmethod |
| 3353 |
|
def get_navi_link(cls, last_soup, next_): |
| 3354 |
|
"""Get link to next or previous comic.""" |
| 3355 |
|
return last_soup.find('a', class_='next' if next_ else 'prev') |
| 3356 |
|
|
| 3357 |
|
@classmethod |
| 3358 |
|
def get_comic_info(cls, soup, link): |
| 3359 |
|
"""Get information about a particular comics.""" |
| 3360 |
|
title = soup.find('meta', property='og:title')['content'] |
| 3361 |
|
date_str = soup.find('time')["datetime"] |
| 3362 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 3363 |
|
imgs = soup.find_all('meta', property='og:image') |
| 3364 |
|
return { |
| 3365 |
|
'title': title, |
| 3366 |
|
'img': [i['content'] for i in imgs], |
| 3367 |
|
'day': day.day, |
| 3368 |
|
'month': day.month, |
| 3369 |
|
'year': day.year, |
| 3370 |
|
} |
| 3371 |
|
|
| 3372 |
|
|
|
@@ 3210-3238 (lines=29) @@
|
| 3207 |
|
} |
| 3208 |
|
|
| 3209 |
|
|
| 3210 |
|
class PomComics(GenericNavigableComic): |
| 3211 |
|
"""Class to retrieve PomComics.""" |
| 3212 |
|
name = 'pom' |
| 3213 |
|
long_name = 'Pom Comics / Piece of Me' |
| 3214 |
|
url = 'http://www.pomcomic.com' |
| 3215 |
|
get_url_from_link = join_cls_url_to_href |
| 3216 |
|
|
| 3217 |
|
@classmethod |
| 3218 |
|
def get_first_comic_link(cls): |
| 3219 |
|
"""Get link to first comics.""" |
| 3220 |
|
return get_soup_at_url(cls.url).find('a', class_='btn_first') |
| 3221 |
|
|
| 3222 |
|
@classmethod |
| 3223 |
|
def get_navi_link(cls, last_soup, next_): |
| 3224 |
|
"""Get link to next or previous comic.""" |
| 3225 |
|
return last_soup.find('a', class_='btn_next' if next_ else 'btn_prev') |
| 3226 |
|
|
| 3227 |
|
@classmethod |
| 3228 |
|
def get_comic_info(cls, soup, link): |
| 3229 |
|
"""Get information about a particular comics.""" |
| 3230 |
|
title = soup.find('h1', id="comic-name").string |
| 3231 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 3232 |
|
tags = soup.find('meta', attrs={'name': 'keywords'})['content'] |
| 3233 |
|
imgs = soup.find('div', class_='comic').find_all('img') |
| 3234 |
|
return { |
| 3235 |
|
'title': title, |
| 3236 |
|
'desc': desc, |
| 3237 |
|
'tags': tags, |
| 3238 |
|
'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
| 3239 |
|
} |
| 3240 |
|
|
| 3241 |
|
|