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