@@ 3291-3320 (lines=30) @@ | ||
3288 | 'img': [i['src'] for i in imgs], |
|
3289 | } |
|
3290 | ||
3291 | ||
3292 | class MarketoonistComics(GenericNavigableComic): |
|
3293 | """Class to retrieve Marketoonist Comics.""" |
|
3294 | name = 'marketoonist' |
|
3295 | long_name = 'Marketoonist' |
|
3296 | url = 'https://marketoonist.com/cartoons' |
|
3297 | get_first_comic_link = simulate_first_link |
|
3298 | get_navi_link = get_link_rel_next |
|
3299 | first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html' |
|
3300 | ||
3301 | @classmethod |
|
3302 | def get_comic_info(cls, soup, link): |
|
3303 | """Get information about a particular comics.""" |
|
3304 | imgs = soup.find_all('meta', property='og:image') |
|
3305 | date_str = soup.find('meta', property='article:published_time')['content'][:10] |
|
3306 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3307 | title = soup.find('meta', property='og:title')['content'] |
|
3308 | return { |
|
3309 | 'img': [i['content'] for i in imgs], |
|
3310 | 'day': day.day, |
|
3311 | 'month': day.month, |
|
3312 | 'year': day.year, |
|
3313 | 'title': title, |
|
3314 | } |
|
3315 | ||
3316 | ||
3317 | class ConsoliaComics(GenericNavigableComic): |
|
3318 | """Class to retrieve Consolia comics.""" |
|
3319 | name = 'consolia' |
|
3320 | long_name = 'consolia' |
|
3321 | url = 'https://consolia-comic.com' |
|
3322 | get_url_from_link = join_cls_url_to_href |
|
3323 | ||
@@ 3161-3189 (lines=29) @@ | ||
3158 | ||
3159 | ||
3160 | class EarthExplodes(GenericNavigableComic): |
|
3161 | """Class to retrieve The Earth Explodes comics.""" |
|
3162 | name = 'earthexplodes' |
|
3163 | long_name = 'The Earth Explodes' |
|
3164 | url = 'http://www.earthexplodes.com' |
|
3165 | get_url_from_link = join_cls_url_to_href |
|
3166 | get_first_comic_link = simulate_first_link |
|
3167 | first_url = 'http://www.earthexplodes.com/comics/000/' |
|
3168 | ||
3169 | @classmethod |
|
3170 | def get_navi_link(cls, last_soup, next_): |
|
3171 | """Get link to next or previous comic.""" |
|
3172 | return last_soup.find('a', id='next' if next_ else 'prev') |
|
3173 | ||
3174 | @classmethod |
|
3175 | def get_comic_info(cls, soup, link): |
|
3176 | """Get information about a particular comics.""" |
|
3177 | title = soup.find('title').string |
|
3178 | imgs = soup.find('div', id='image').find_all('img') |
|
3179 | alt = imgs[0].get('title', '') |
|
3180 | return { |
|
3181 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
3182 | 'title': title, |
|
3183 | 'alt': alt, |
|
3184 | } |
|
3185 | ||
3186 | ||
3187 | class PomComics(GenericNavigableComic): |
|
3188 | """Class to retrieve PomComics.""" |
|
3189 | name = 'pom' |
|
3190 | long_name = 'Pom Comics / Piece of Me' |
|
3191 | url = 'http://www.pomcomic.com' |
|
3192 | get_url_from_link = join_cls_url_to_href |