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