@@ 3321-3344 (lines=24) @@ | ||
3318 | ||
3319 | class GeekAndPoke(GenericNavigableComic): |
|
3320 | """Class to retrieve Geek And Poke comics.""" |
|
3321 | name = 'geek' |
|
3322 | long_name = 'Geek And Poke' |
|
3323 | url = 'http://geek-and-poke.com' |
|
3324 | get_url_from_link = join_cls_url_to_href |
|
3325 | get_first_comic_link = simulate_first_link |
|
3326 | first_url = 'http://geek-and-poke.com/geekandpoke/2006/8/27/a-new-place-for-a-not-so-old-blog.html' |
|
3327 | ||
3328 | @classmethod |
|
3329 | def get_navi_link(cls, last_soup, next_): |
|
3330 | """Get link to next or previous comic.""" |
|
3331 | return last_soup.find('a', class_='prev-item' if next_ else 'next-item') |
|
3332 | ||
3333 | @classmethod |
|
3334 | def get_comic_info(cls, soup, link): |
|
3335 | """Get information about a particular comics.""" |
|
3336 | title = soup.find('meta', property='og:title')['content'] |
|
3337 | desc = soup.find('meta', property='og:description')['content'] |
|
3338 | date_str = soup.find('time', class_='published')['datetime'] |
|
3339 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3340 | author = soup.find('a', rel='author').string |
|
3341 | div_content = (soup.find('div', class_="body entry-content") or |
|
3342 | soup.find('div', class_="special-content")) |
|
3343 | imgs = div_content.find_all('img') |
|
3344 | imgs = [i for i in imgs if i.get('src') is not None] |
|
3345 | assert all('title' not in i or i['alt'] == i['title'] for i in imgs) |
|
3346 | alt = imgs[0].get('alt', "") if imgs else [] |
|
3347 | return { |
|
@@ 3254-3277 (lines=24) @@ | ||
3251 | 'img': [i['content'] for i in imgs], |
|
3252 | 'day': day.day, |
|
3253 | 'month': day.month, |
|
3254 | 'year': day.year, |
|
3255 | 'title': title, |
|
3256 | } |
|
3257 | ||
3258 | ||
3259 | class ConsoliaComics(GenericNavigableComic): |
|
3260 | """Class to retrieve Consolia comics.""" |
|
3261 | name = 'consolia' |
|
3262 | long_name = 'consolia' |
|
3263 | url = 'https://consolia-comic.com' |
|
3264 | get_url_from_link = join_cls_url_to_href |
|
3265 | ||
3266 | @classmethod |
|
3267 | def get_first_comic_link(cls): |
|
3268 | """Get link to first comics.""" |
|
3269 | return get_soup_at_url(cls.url).find('a', class_='first') |
|
3270 | ||
3271 | @classmethod |
|
3272 | def get_navi_link(cls, last_soup, next_): |
|
3273 | """Get link to next or previous comic.""" |
|
3274 | return last_soup.find('a', class_='next' if next_ else 'prev') |
|
3275 | ||
3276 | @classmethod |
|
3277 | def get_comic_info(cls, soup, link): |
|
3278 | """Get information about a particular comics.""" |
|
3279 | title = soup.find('meta', property='og:title')['content'] |
|
3280 | date_str = soup.find('time')["datetime"] |