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