@@ 3510-3527 (lines=18) @@ | ||
3507 | @classmethod |
|
3508 | def get_comic_info(cls, soup, link): |
|
3509 | """Get information about a particular comics.""" |
|
3510 | title = soup.find('meta', property='og:title')['content'] |
|
3511 | desc = soup.find('meta', property='og:description')['content'] |
|
3512 | date_str = soup.find('time', class_='published')['datetime'] |
|
3513 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3514 | author = soup.find('a', rel='author').string |
|
3515 | div_content = (soup.find('div', class_="body entry-content") or |
|
3516 | soup.find('div', class_="special-content")) |
|
3517 | imgs = div_content.find_all('img') |
|
3518 | imgs = [i for i in imgs if i.get('src') is not None] |
|
3519 | assert all('title' not in i or i['alt'] == i['title'] for i in imgs) |
|
3520 | alt = imgs[0].get('alt', "") if imgs else [] |
|
3521 | return { |
|
3522 | 'title': title, |
|
3523 | 'alt': alt, |
|
3524 | 'description': desc, |
|
3525 | 'author': author, |
|
3526 | 'day': day.day, |
|
3527 | 'month': day.month, |
|
3528 | 'year': day.year, |
|
3529 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
3530 | } |
|
@@ 3425-3442 (lines=18) @@ | ||
3422 | """Get information about a particular comics.""" |
|
3423 | title = soup.find('meta', property='og:title')['content'] |
|
3424 | date_str = soup.find('time')["datetime"] |
|
3425 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3426 | imgs = soup.find_all('meta', property='og:image') |
|
3427 | return { |
|
3428 | 'title': title, |
|
3429 | 'img': [i['content'] for i in imgs], |
|
3430 | 'day': day.day, |
|
3431 | 'month': day.month, |
|
3432 | 'year': day.year, |
|
3433 | } |
|
3434 | ||
3435 | ||
3436 | class GenericBlogspotComic(GenericNavigableComic): |
|
3437 | """Generic class to retrieve comics from Blogspot.""" |
|
3438 | get_first_comic_link = simulate_first_link |
|
3439 | first_url = NotImplemented |
|
3440 | _categories = ('BLOGSPOT', ) |
|
3441 | ||
3442 | @classmethod |
|
3443 | def get_navi_link(cls, last_soup, next_): |
|
3444 | """Get link to next or previous comic.""" |
|
3445 | return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link') |