@@ 694-715 (lines=22) @@ | ||
691 | 'day': day.day, |
|
692 | 'img': [i['content'] for i in imgs], |
|
693 | } |
|
694 | ||
695 | ||
696 | class NeDroid(GenericNavigableComic): |
|
697 | """Class to retrieve NeDroid comics.""" |
|
698 | name = 'nedroid' |
|
699 | long_name = 'NeDroid' |
|
700 | url = 'http://nedroid.com' |
|
701 | get_first_comic_link = get_div_navfirst_a |
|
702 | get_navi_link = get_link_rel_next |
|
703 | get_url_from_link = join_cls_url_to_href |
|
704 | ||
705 | @classmethod |
|
706 | def get_comic_info(cls, soup, link): |
|
707 | """Get information about a particular comics.""" |
|
708 | short_url_re = re.compile('^%s/\\?p=([0-9]*)' % cls.url) |
|
709 | comic_url_re = re.compile('//nedroid.com/comics/([0-9]*)-([0-9]*)-([0-9]*).*') |
|
710 | short_url = cls.get_url_from_link(soup.find('link', rel='shortlink')) |
|
711 | num = int(short_url_re.match(short_url).groups()[0]) |
|
712 | imgs = soup.find('div', id='comic').find_all('img') |
|
713 | year, month, day = [int(s) for s in comic_url_re.match(imgs[0]['src']).groups()] |
|
714 | assert len(imgs) == 1 |
|
715 | title = imgs[0]['alt'] |
|
716 | title2 = imgs[0]['title'] |
|
717 | return { |
|
718 | 'short_url': short_url, |
|
@@ 643-664 (lines=22) @@ | ||
640 | 'year': day.year, |
|
641 | 'day': day.day, |
|
642 | } |
|
643 | ||
644 | ||
645 | class OneOneOneOneComic(GenericNavigableComic): |
|
646 | """Class to retrieve 1111 Comics.""" |
|
647 | # Also on http://comics1111.tumblr.com |
|
648 | # Also on https://tapastic.com/series/1111-Comics |
|
649 | name = '1111' |
|
650 | long_name = '1111 Comics' |
|
651 | url = 'http://www.1111comics.me' |
|
652 | get_first_comic_link = get_div_navfirst_a |
|
653 | get_navi_link = get_link_rel_next |
|
654 | ||
655 | @classmethod |
|
656 | def get_comic_info(cls, soup, link): |
|
657 | """Get information about a particular comics.""" |
|
658 | title = soup.find('h1', class_='comic-title').find('a').string |
|
659 | date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string |
|
660 | day = string_to_date(date_str, "%B %d, %Y") |
|
661 | imgs = soup.find_all('meta', property='og:image') |
|
662 | return { |
|
663 | 'title': title, |
|
664 | 'month': day.month, |
|
665 | 'year': day.year, |
|
666 | 'day': day.day, |
|
667 | 'img': [i['content'] for i in imgs], |
|
@@ 2600-2620 (lines=21) @@ | ||
2597 | } |
|
2598 | ||
2599 | ||
2600 | class BuniComic(GenericNavigableComic): |
|
2601 | """Class to retrieve Buni Comics.""" |
|
2602 | name = 'buni' |
|
2603 | long_name = 'BuniComics' |
|
2604 | url = 'http://www.bunicomic.com' |
|
2605 | get_first_comic_link = get_a_comicnavbase_comicnavfirst |
|
2606 | get_navi_link = get_link_rel_next |
|
2607 | ||
2608 | @classmethod |
|
2609 | def get_comic_info(cls, soup, link): |
|
2610 | """Get information about a particular comics.""" |
|
2611 | imgs = soup.find('div', id='comic').find_all('img') |
|
2612 | assert all(i['alt'] == i['title'] for i in imgs) |
|
2613 | assert len(imgs) == 1 |
|
2614 | return { |
|
2615 | 'img': [i['src'] for i in imgs], |
|
2616 | 'title': imgs[0]['title'], |
|
2617 | } |
|
2618 | ||
2619 | ||
2620 | class GenericCommitStrip(GenericNavigableComic): |
|
2621 | """Generic class to retrieve Commit Strips in different languages.""" |
|
2622 | get_navi_link = get_a_rel_next |
|
2623 | get_first_comic_link = simulate_first_link |