@@ 3320-3349 (lines=30) @@ | ||
3317 | get_first_comic_link = simulate_first_link |
|
3318 | get_navi_link = get_link_rel_next |
|
3319 | first_url = 'https://marketoonist.com/2002/10/the-8-types-of-brand-managers-2.html' |
|
3320 | ||
3321 | @classmethod |
|
3322 | def get_comic_info(cls, soup, link): |
|
3323 | """Get information about a particular comics.""" |
|
3324 | imgs = soup.find_all('meta', property='og:image') |
|
3325 | date_str = soup.find('meta', property='article:published_time')['content'][:10] |
|
3326 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3327 | title = soup.find('meta', property='og:title')['content'] |
|
3328 | return { |
|
3329 | 'img': [i['content'] for i in imgs], |
|
3330 | 'day': day.day, |
|
3331 | 'month': day.month, |
|
3332 | 'year': day.year, |
|
3333 | 'title': title, |
|
3334 | } |
|
3335 | ||
3336 | ||
3337 | class ConsoliaComics(GenericNavigableComic): |
|
3338 | """Class to retrieve Consolia comics.""" |
|
3339 | name = 'consolia' |
|
3340 | long_name = 'consolia' |
|
3341 | url = 'https://consolia-comic.com' |
|
3342 | get_url_from_link = join_cls_url_to_href |
|
3343 | ||
3344 | @classmethod |
|
3345 | def get_first_comic_link(cls): |
|
3346 | """Get link to first comics.""" |
|
3347 | return get_soup_at_url(cls.url).find('a', class_='first') |
|
3348 | ||
3349 | @classmethod |
|
3350 | def get_navi_link(cls, last_soup, next_): |
|
3351 | """Get link to next or previous comic.""" |
|
3352 | return last_soup.find('a', class_='next' if next_ else 'prev') |
|
@@ 3190-3218 (lines=29) @@ | ||
3187 | first_url = 'http://www.earthexplodes.com/comics/000/' |
|
3188 | ||
3189 | @classmethod |
|
3190 | def get_navi_link(cls, last_soup, next_): |
|
3191 | """Get link to next or previous comic.""" |
|
3192 | return last_soup.find('a', id='next' if next_ else 'prev') |
|
3193 | ||
3194 | @classmethod |
|
3195 | def get_comic_info(cls, soup, link): |
|
3196 | """Get information about a particular comics.""" |
|
3197 | title = soup.find('title').string |
|
3198 | imgs = soup.find('div', id='image').find_all('img') |
|
3199 | alt = imgs[0].get('title', '') |
|
3200 | return { |
|
3201 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
3202 | 'title': title, |
|
3203 | 'alt': alt, |
|
3204 | } |
|
3205 | ||
3206 | ||
3207 | class PomComics(GenericNavigableComic): |
|
3208 | """Class to retrieve PomComics.""" |
|
3209 | name = 'pom' |
|
3210 | long_name = 'Pom Comics / Piece of Me' |
|
3211 | url = 'http://www.pomcomic.com' |
|
3212 | get_url_from_link = join_cls_url_to_href |
|
3213 | ||
3214 | @classmethod |
|
3215 | def get_first_comic_link(cls): |
|
3216 | """Get link to first comics.""" |
|
3217 | return get_soup_at_url(cls.url).find('a', class_='btn_first') |
|
3218 | ||
3219 | @classmethod |
|
3220 | def get_navi_link(cls, last_soup, next_): |
|
3221 | """Get link to next or previous comic.""" |