@@ 3040-3060 (lines=21) @@ | ||
3037 | li = last_soup.find('li', class_='prev' if next_ else 'next') |
|
3038 | return li.find('a') if li else None |
|
3039 | ||
3040 | @classmethod |
|
3041 | def get_comic_info(cls, soup, link): |
|
3042 | """Get information about a particular comics.""" |
|
3043 | title = soup.find('meta', property='og:title')['content'] |
|
3044 | desc = soup.find('meta', property='og:description')['content'] |
|
3045 | date_str = soup.find('time', class_='published')['datetime'] |
|
3046 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3047 | author = soup.find('a', rel='author').string |
|
3048 | div_content = soup.find('div', class_="body entry-content") |
|
3049 | imgs = div_content.find_all('img') |
|
3050 | imgs = [i for i in imgs if i.get('src') is not None] |
|
3051 | alt = imgs[0]['alt'] |
|
3052 | return { |
|
3053 | 'title': title, |
|
3054 | 'alt': alt, |
|
3055 | 'description': desc, |
|
3056 | 'author': author, |
|
3057 | 'day': day.day, |
|
3058 | 'month': day.month, |
|
3059 | 'year': day.year, |
|
3060 | 'img': [i['src'] for i in imgs], |
|
3061 | } |
|
3062 | ||
3063 | ||
@@ 831-849 (lines=19) @@ | ||
828 | link = last_soup.find('div', class_='nav-comic nav-right' if next_ else 'nav-comic nav-left') |
|
829 | return link.find('a') if link else None |
|
830 | ||
831 | @classmethod |
|
832 | def get_comic_info(cls, soup, link): |
|
833 | """Get information about a particular comics.""" |
|
834 | title = soup.find('meta', property='og:title')['content'] |
|
835 | imgs = soup.find_all('meta', property='og:image') |
|
836 | desc = soup.find('meta', property='og:description')['content'] |
|
837 | date_str = soup.find('meta', property='article:publish_date')['content'] |
|
838 | day = string_to_date(date_str, "%B %d, %Y") |
|
839 | author = soup.find('meta', property='article:author')['content'] |
|
840 | tags = soup.find('meta', property='article:tag')['content'] |
|
841 | return { |
|
842 | 'title': title, |
|
843 | 'description': desc, |
|
844 | 'img': [i['content'] for i in imgs], |
|
845 | 'author': author, |
|
846 | 'tags': tags, |
|
847 | 'day': day.day, |
|
848 | 'month': day.month, |
|
849 | 'year': day.year |
|
850 | } |
|
851 | ||
852 |