@@ 3440-3463 (lines=24) @@ | ||
3437 | ||
3438 | @classmethod |
|
3439 | def get_comic_info(cls, soup, link): |
|
3440 | """Get information about a particular comics.""" |
|
3441 | title = soup.find('meta', property='og:title')['content'] |
|
3442 | desc = soup.find('meta', property='og:description')['content'] |
|
3443 | date_str = soup.find('time', class_='published')['datetime'] |
|
3444 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3445 | author = soup.find('a', rel='author').string |
|
3446 | div_content = (soup.find('div', class_="body entry-content") or |
|
3447 | soup.find('div', class_="special-content")) |
|
3448 | imgs = div_content.find_all('img') |
|
3449 | imgs = [i for i in imgs if i.get('src') is not None] |
|
3450 | assert all('title' not in i or i['alt'] == i['title'] for i in imgs) |
|
3451 | alt = imgs[0].get('alt', "") if imgs else [] |
|
3452 | return { |
|
3453 | 'title': title, |
|
3454 | 'alt': alt, |
|
3455 | 'description': desc, |
|
3456 | 'author': author, |
|
3457 | 'day': day.day, |
|
3458 | 'month': day.month, |
|
3459 | 'year': day.year, |
|
3460 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
3461 | } |
|
3462 | ||
3463 | ||
3464 | class GloryOwlComix(GenericNavigableComic): |
|
3465 | """Class to retrieve Glory Owl comics.""" |
|
3466 | name = 'gloryowl' |
|
@@ 3373-3396 (lines=24) @@ | ||
3370 | ||
3371 | @classmethod |
|
3372 | def get_first_comic_link(cls): |
|
3373 | """Get link to first comics.""" |
|
3374 | return get_soup_at_url(cls.url).find('a', class_='first') |
|
3375 | ||
3376 | @classmethod |
|
3377 | def get_navi_link(cls, last_soup, next_): |
|
3378 | """Get link to next or previous comic.""" |
|
3379 | return last_soup.find('a', class_='next' if next_ else 'prev') |
|
3380 | ||
3381 | @classmethod |
|
3382 | def get_comic_info(cls, soup, link): |
|
3383 | """Get information about a particular comics.""" |
|
3384 | title = soup.find('meta', property='og:title')['content'] |
|
3385 | date_str = soup.find('time')["datetime"] |
|
3386 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3387 | imgs = soup.find_all('meta', property='og:image') |
|
3388 | return { |
|
3389 | 'title': title, |
|
3390 | 'img': [i['content'] for i in imgs], |
|
3391 | 'day': day.day, |
|
3392 | 'month': day.month, |
|
3393 | 'year': day.year, |
|
3394 | } |
|
3395 | ||
3396 | ||
3397 | class TuMourrasMoinsBete(GenericNavigableComic): |
|
3398 | """Class to retrieve Tu Mourras Moins Bete comics.""" |
|
3399 | name = 'mourrasmoinsbete' |
|
@@ 3183-3206 (lines=24) @@ | ||
3180 | } |
|
3181 | ||
3182 | ||
3183 | class EarthExplodes(GenericNavigableComic): |
|
3184 | """Class to retrieve The Earth Explodes comics.""" |
|
3185 | name = 'earthexplodes' |
|
3186 | long_name = 'The Earth Explodes' |
|
3187 | url = 'http://www.earthexplodes.com' |
|
3188 | get_url_from_link = join_cls_url_to_href |
|
3189 | get_first_comic_link = simulate_first_link |
|
3190 | first_url = 'http://www.earthexplodes.com/comics/000/' |
|
3191 | ||
3192 | @classmethod |
|
3193 | def get_navi_link(cls, last_soup, next_): |
|
3194 | """Get link to next or previous comic.""" |
|
3195 | return last_soup.find('a', id='next' if next_ else 'prev') |
|
3196 | ||
3197 | @classmethod |
|
3198 | def get_comic_info(cls, soup, link): |
|
3199 | """Get information about a particular comics.""" |
|
3200 | title = soup.find('title').string |
|
3201 | imgs = soup.find('div', id='image').find_all('img') |
|
3202 | alt = imgs[0].get('title', '') |
|
3203 | return { |
|
3204 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
3205 | 'title': title, |
|
3206 | 'alt': alt, |
|
3207 | } |
|
3208 | ||
3209 |