|
@@ 3071-3091 (lines=21) @@
|
| 3068 |
|
return li.find('a') if li else None |
| 3069 |
|
|
| 3070 |
|
@classmethod |
| 3071 |
|
def get_comic_info(cls, soup, link): |
| 3072 |
|
"""Get information about a particular comics.""" |
| 3073 |
|
title = soup.find('meta', property='og:title')['content'] |
| 3074 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 3075 |
|
date_str = soup.find('time', class_='published')['datetime'] |
| 3076 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 3077 |
|
author = soup.find('a', rel='author').string |
| 3078 |
|
div_content = soup.find('div', class_="body entry-content") |
| 3079 |
|
imgs = div_content.find_all('img') |
| 3080 |
|
imgs = [i for i in imgs if i.get('src') is not None] |
| 3081 |
|
alt = imgs[0]['alt'] |
| 3082 |
|
return { |
| 3083 |
|
'title': title, |
| 3084 |
|
'alt': alt, |
| 3085 |
|
'description': desc, |
| 3086 |
|
'author': author, |
| 3087 |
|
'day': day.day, |
| 3088 |
|
'month': day.month, |
| 3089 |
|
'year': day.year, |
| 3090 |
|
'img': [i['src'] for i in imgs], |
| 3091 |
|
} |
| 3092 |
|
|
| 3093 |
|
|
| 3094 |
|
class GenericWordPressInkblot(GenericNavigableComic): |
|
@@ 829-847 (lines=19) @@
|
| 826 |
|
link = last_soup.find('div', class_='nav-comic nav-right' if next_ else 'nav-comic nav-left') |
| 827 |
|
return link.find('a') if link else None |
| 828 |
|
|
| 829 |
|
@classmethod |
| 830 |
|
def get_comic_info(cls, soup, link): |
| 831 |
|
"""Get information about a particular comics.""" |
| 832 |
|
title = soup.find('meta', property='og:title')['content'] |
| 833 |
|
imgs = soup.find_all('meta', property='og:image') |
| 834 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 835 |
|
date_str = soup.find('meta', property='article:publish_date')['content'] |
| 836 |
|
day = string_to_date(date_str, "%B %d, %Y") |
| 837 |
|
author = soup.find('meta', property='article:author')['content'] |
| 838 |
|
tags = soup.find('meta', property='article:tag')['content'] |
| 839 |
|
return { |
| 840 |
|
'title': title, |
| 841 |
|
'description': desc, |
| 842 |
|
'img': [i['content'] for i in imgs], |
| 843 |
|
'author': author, |
| 844 |
|
'tags': tags, |
| 845 |
|
'day': day.day, |
| 846 |
|
'month': day.month, |
| 847 |
|
'year': day.year |
| 848 |
|
} |
| 849 |
|
|
| 850 |
|
|