@@ 2150-2170 (lines=21) @@ | ||
2147 | ||
2148 | ||
2149 | class DepressedAlien(GenericNavigableComic): |
|
2150 | """Class to retrieve Depressed Alien Comics.""" |
|
2151 | name = 'depressedalien' |
|
2152 | long_name = 'Depressed Alien' |
|
2153 | url = 'http://depressedalien.com' |
|
2154 | get_url_from_link = join_cls_url_to_href |
|
2155 | ||
2156 | @classmethod |
|
2157 | def get_first_comic_link(cls): |
|
2158 | """Get link to first comics.""" |
|
2159 | return get_soup_at_url(cls.url).find('img', attrs={'name': 'beginArrow'}).parent |
|
2160 | ||
2161 | @classmethod |
|
2162 | def get_navi_link(cls, last_soup, next_): |
|
2163 | """Get link to next or previous comic.""" |
|
2164 | return last_soup.find('img', attrs={'name': 'rightArrow' if next_ else 'leftArrow'}).parent |
|
2165 | ||
2166 | @classmethod |
|
2167 | def get_comic_info(cls, soup, link): |
|
2168 | """Get information about a particular comics.""" |
|
2169 | title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
|
2170 | imgs = soup.find_all('meta', property='og:image') |
|
2171 | return { |
|
2172 | 'title': title, |
|
2173 | 'img': [i['content'] for i in imgs], |
|
@@ 2778-2795 (lines=18) @@ | ||
2775 | imgs = soup.find('div', id='comic').find_all('img') |
|
2776 | return { |
|
2777 | 'title': title, |
|
2778 | 'img': [i['src'] for i in imgs], |
|
2779 | 'month': day.month, |
|
2780 | 'year': day.year, |
|
2781 | 'day': day.day, |
|
2782 | } |
|
2783 | ||
2784 | ||
2785 | class BuniComic(GenericNavigableComic): |
|
2786 | """Class to retrieve Buni Comics.""" |
|
2787 | name = 'buni' |
|
2788 | long_name = 'BuniComics' |
|
2789 | url = 'http://www.bunicomic.com' |
|
2790 | get_first_comic_link = get_a_comicnavbase_comicnavfirst |
|
2791 | get_navi_link = get_link_rel_next |
|
2792 | ||
2793 | @classmethod |
|
2794 | def get_comic_info(cls, soup, link): |
|
2795 | """Get information about a particular comics.""" |
|
2796 | imgs = soup.find('div', id='comic').find_all('img') |
|
2797 | assert all(i['alt'] == i['title'] for i in imgs) |
|
2798 | assert len(imgs) == 1 |