@@ 3450-3479 (lines=30) @@ | ||
3447 | } |
|
3448 | ||
3449 | ||
3450 | class ConsoliaComics(GenericNavigableComic): |
|
3451 | """Class to retrieve Consolia comics.""" |
|
3452 | name = 'consolia' |
|
3453 | long_name = 'consolia' |
|
3454 | url = 'https://consolia-comic.com' |
|
3455 | get_url_from_link = join_cls_url_to_href |
|
3456 | ||
3457 | @classmethod |
|
3458 | def get_first_comic_link(cls): |
|
3459 | """Get link to first comics.""" |
|
3460 | return get_soup_at_url(cls.url).find('a', class_='first') |
|
3461 | ||
3462 | @classmethod |
|
3463 | def get_navi_link(cls, last_soup, next_): |
|
3464 | """Get link to next or previous comic.""" |
|
3465 | return last_soup.find('a', class_='next' if next_ else 'prev') |
|
3466 | ||
3467 | @classmethod |
|
3468 | def get_comic_info(cls, soup, link): |
|
3469 | """Get information about a particular comics.""" |
|
3470 | title = soup.find('meta', property='og:title')['content'] |
|
3471 | date_str = soup.find('time')["datetime"] |
|
3472 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3473 | imgs = soup.find_all('meta', property='og:image') |
|
3474 | return { |
|
3475 | 'title': title, |
|
3476 | 'img': [i['content'] for i in imgs], |
|
3477 | 'day': day.day, |
|
3478 | 'month': day.month, |
|
3479 | 'year': day.year, |
|
3480 | } |
|
3481 | ||
3482 | ||
@@ 3296-3324 (lines=29) @@ | ||
3293 | } |
|
3294 | ||
3295 | ||
3296 | class PomComics(GenericNavigableComic): |
|
3297 | """Class to retrieve PomComics.""" |
|
3298 | name = 'pom' |
|
3299 | long_name = 'Pom Comics / Piece of Me' |
|
3300 | url = 'http://www.pomcomic.com' |
|
3301 | get_url_from_link = join_cls_url_to_href |
|
3302 | ||
3303 | @classmethod |
|
3304 | def get_first_comic_link(cls): |
|
3305 | """Get link to first comics.""" |
|
3306 | return get_soup_at_url(cls.url).find('a', class_='btn-first') |
|
3307 | ||
3308 | @classmethod |
|
3309 | def get_navi_link(cls, last_soup, next_): |
|
3310 | """Get link to next or previous comic.""" |
|
3311 | return last_soup.find('a', class_='btn-next' if next_ else 'btn-prev') |
|
3312 | ||
3313 | @classmethod |
|
3314 | def get_comic_info(cls, soup, link): |
|
3315 | """Get information about a particular comics.""" |
|
3316 | title = soup.find('h1').string |
|
3317 | desc = soup.find('meta', property='og:description')['content'] |
|
3318 | tags = soup.find('meta', attrs={'name': 'keywords'})['content'] |
|
3319 | imgs = soup.find('div', class_='comic').find_all('img') |
|
3320 | return { |
|
3321 | 'title': title, |
|
3322 | 'desc': desc, |
|
3323 | 'tags': tags, |
|
3324 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
3325 | } |
|
3326 | ||
3327 |