|
@@ 2970-2990 (lines=21) @@
|
| 2967 |
|
li = last_soup.find('li', class_='prev' if next_ else 'next') |
| 2968 |
|
return li.find('a') if li else None |
| 2969 |
|
|
| 2970 |
|
@classmethod |
| 2971 |
|
def get_comic_info(cls, soup, link): |
| 2972 |
|
"""Get information about a particular comics.""" |
| 2973 |
|
title = soup.find('meta', property='og:title')['content'] |
| 2974 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 2975 |
|
date_str = soup.find('time', class_='published')['datetime'] |
| 2976 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2977 |
|
author = soup.find('a', rel='author').string |
| 2978 |
|
div_content = soup.find('div', class_="body entry-content") |
| 2979 |
|
imgs = div_content.find_all('img') |
| 2980 |
|
imgs = [i for i in imgs if i.get('src') is not None] |
| 2981 |
|
alt = imgs[0]['alt'] |
| 2982 |
|
return { |
| 2983 |
|
'title': title, |
| 2984 |
|
'alt': alt, |
| 2985 |
|
'description': desc, |
| 2986 |
|
'author': author, |
| 2987 |
|
'day': day.day, |
| 2988 |
|
'month': day.month, |
| 2989 |
|
'year': day.year, |
| 2990 |
|
'img': [i['src'] for i in imgs], |
| 2991 |
|
} |
| 2992 |
|
|
| 2993 |
|
|
|
@@ 800-818 (lines=19) @@
|
| 797 |
|
link = last_soup.find('div', class_='nav-comic nav-right' if next_ else 'nav-comic nav-left') |
| 798 |
|
return link.find('a') if link else None |
| 799 |
|
|
| 800 |
|
@classmethod |
| 801 |
|
def get_comic_info(cls, soup, link): |
| 802 |
|
"""Get information about a particular comics.""" |
| 803 |
|
title = soup.find('meta', property='og:title')['content'] |
| 804 |
|
imgs = soup.find_all('meta', property='og:image') |
| 805 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 806 |
|
date_str = soup.find('meta', property='article:publish_date')['content'] |
| 807 |
|
day = string_to_date(date_str, "%B %d, %Y") |
| 808 |
|
author = soup.find('meta', property='article:author')['content'] |
| 809 |
|
tags = soup.find('meta', property='article:tag')['content'] |
| 810 |
|
return { |
| 811 |
|
'title': title, |
| 812 |
|
'description': desc, |
| 813 |
|
'img': [i['content'] for i in imgs], |
| 814 |
|
'author': author, |
| 815 |
|
'tags': tags, |
| 816 |
|
'day': day.day, |
| 817 |
|
'month': day.month, |
| 818 |
|
'year': day.year |
| 819 |
|
} |
| 820 |
|
|
| 821 |
|
|