@@ 3493-3516 (lines=24) @@ | ||
3490 | first_url = 'http://geek-and-poke.com/geekandpoke/2006/8/27/a-new-place-for-a-not-so-old-blog.html' |
|
3491 | ||
3492 | @classmethod |
|
3493 | def get_navi_link(cls, last_soup, next_): |
|
3494 | """Get link to next or previous comic.""" |
|
3495 | return last_soup.find('a', class_='prev-item' if next_ else 'next-item') |
|
3496 | ||
3497 | @classmethod |
|
3498 | def get_comic_info(cls, soup, link): |
|
3499 | """Get information about a particular comics.""" |
|
3500 | title = soup.find('meta', property='og:title')['content'] |
|
3501 | desc = soup.find('meta', property='og:description')['content'] |
|
3502 | date_str = soup.find('time', class_='published')['datetime'] |
|
3503 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3504 | author = soup.find('a', rel='author').string |
|
3505 | div_content = (soup.find('div', class_="body entry-content") or |
|
3506 | soup.find('div', class_="special-content")) |
|
3507 | imgs = div_content.find_all('img') |
|
3508 | imgs = [i for i in imgs if i.get('src') is not None] |
|
3509 | assert all('title' not in i or i['alt'] == i['title'] for i in imgs) |
|
3510 | alt = imgs[0].get('alt', "") if imgs else [] |
|
3511 | return { |
|
3512 | 'title': title, |
|
3513 | 'alt': alt, |
|
3514 | 'description': desc, |
|
3515 | 'author': author, |
|
3516 | 'day': day.day, |
|
3517 | 'month': day.month, |
|
3518 | 'year': day.year, |
|
3519 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
@@ 3426-3449 (lines=24) @@ | ||
3423 | class ConsoliaComics(GenericNavigableComic): |
|
3424 | """Class to retrieve Consolia comics.""" |
|
3425 | name = 'consolia' |
|
3426 | long_name = 'consolia' |
|
3427 | url = 'https://consolia-comic.com' |
|
3428 | get_url_from_link = join_cls_url_to_href |
|
3429 | ||
3430 | @classmethod |
|
3431 | def get_first_comic_link(cls): |
|
3432 | """Get link to first comics.""" |
|
3433 | return get_soup_at_url(cls.url).find('a', class_='first') |
|
3434 | ||
3435 | @classmethod |
|
3436 | def get_navi_link(cls, last_soup, next_): |
|
3437 | """Get link to next or previous comic.""" |
|
3438 | return last_soup.find('a', class_='next' if next_ else 'prev') |
|
3439 | ||
3440 | @classmethod |
|
3441 | def get_comic_info(cls, soup, link): |
|
3442 | """Get information about a particular comics.""" |
|
3443 | title = soup.find('meta', property='og:title')['content'] |
|
3444 | date_str = soup.find('time')["datetime"] |
|
3445 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3446 | imgs = soup.find_all('meta', property='og:image') |
|
3447 | return { |
|
3448 | 'title': title, |
|
3449 | 'img': [i['content'] for i in imgs], |
|
3450 | 'day': day.day, |
|
3451 | 'month': day.month, |
|
3452 | 'year': day.year, |