|
@@ 1766-1785 (lines=20) @@
|
| 1763 |
|
def get_first_comic_link(cls): |
| 1764 |
|
"""Get link to first comics.""" |
| 1765 |
|
return {'href': 'http://respawncomic.com/comic/c0001/'} |
| 1766 |
|
|
| 1767 |
|
@classmethod |
| 1768 |
|
def get_comic_info(cls, soup, link): |
| 1769 |
|
"""Get information about a particular comics.""" |
| 1770 |
|
title = soup.find('meta', property='og:title')['content'] |
| 1771 |
|
author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
| 1772 |
|
date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
| 1773 |
|
date_str = date_str[:10] |
| 1774 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 1775 |
|
imgs = soup.find_all('meta', property='og:image') |
| 1776 |
|
skip_imgs = { |
| 1777 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
| 1778 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
| 1779 |
|
} |
| 1780 |
|
return { |
| 1781 |
|
'title': title, |
| 1782 |
|
'author': author, |
| 1783 |
|
'day': day.day, |
| 1784 |
|
'month': day.month, |
| 1785 |
|
'year': day.year, |
| 1786 |
|
'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
| 1787 |
|
} |
| 1788 |
|
|
|
@@ 1011-1029 (lines=19) @@
|
| 1008 |
|
get_first_comic_link = get_a_comicnavbase_comicnavfirst |
| 1009 |
|
get_navi_link = get_a_rel_next |
| 1010 |
|
|
| 1011 |
|
@classmethod |
| 1012 |
|
def get_comic_info(cls, soup, link): |
| 1013 |
|
"""Get information about a particular comics.""" |
| 1014 |
|
title = soup.find('meta', property='og:title')['content'] |
| 1015 |
|
metadesc = soup.find('meta', property='og:description') |
| 1016 |
|
desc = metadesc['content'] if metadesc else "" |
| 1017 |
|
author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
| 1018 |
|
date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
| 1019 |
|
date_str = date_str[:10] |
| 1020 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 1021 |
|
imgs = soup.find_all('meta', property='og:image') |
| 1022 |
|
return { |
| 1023 |
|
'img': [i['content'] for i in imgs], |
| 1024 |
|
'title': title, |
| 1025 |
|
'author': author, |
| 1026 |
|
'desc': desc, |
| 1027 |
|
'day': day.day, |
| 1028 |
|
'month': day.month, |
| 1029 |
|
'year': day.year |
| 1030 |
|
} |
| 1031 |
|
|
| 1032 |
|
|
|
@@ 498-513 (lines=16) @@
|
| 495 |
|
li = last_soup.find('li', class_='prev' if next_ else 'next') |
| 496 |
|
return li.find('a') if li else None |
| 497 |
|
|
| 498 |
|
@classmethod |
| 499 |
|
def get_comic_info(cls, soup, link): |
| 500 |
|
"""Get information about a particular comics.""" |
| 501 |
|
short_url = soup.find('link', rel='shortlink')['href'] |
| 502 |
|
title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
| 503 |
|
imgs = soup.find_all('meta', property='og:image') |
| 504 |
|
date_str = soup.find('span', property='dc:date')['content'] |
| 505 |
|
date_str = date_str[:10] |
| 506 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 507 |
|
return { |
| 508 |
|
'short_url': short_url, |
| 509 |
|
'title': title, |
| 510 |
|
'img': [i['content'] for i in imgs], |
| 511 |
|
'day': day.day, |
| 512 |
|
'month': day.month, |
| 513 |
|
'year': day.year, |
| 514 |
|
} |
| 515 |
|
|
| 516 |
|
|
|
@@ 2884-2898 (lines=15) @@
|
| 2881 |
|
# prev is next / next is prev |
| 2882 |
|
return last_soup.find('li', class_='previous' if next_ else 'next').find('a') |
| 2883 |
|
|
| 2884 |
|
@classmethod |
| 2885 |
|
def get_comic_info(cls, soup, link): |
| 2886 |
|
"""Get information about a particular comics.""" |
| 2887 |
|
date_str = soup.find('time', class_='published')['datetime'] |
| 2888 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2889 |
|
author = soup.find('span', class_='blog-author').find('a').string |
| 2890 |
|
title = soup.find('meta', property='og:title')['content'] |
| 2891 |
|
imgs = soup.find_all('meta', itemprop='image') |
| 2892 |
|
return { |
| 2893 |
|
'img': [i['content'] for i in imgs], |
| 2894 |
|
'title': title, |
| 2895 |
|
'author': author, |
| 2896 |
|
'day': day.day, |
| 2897 |
|
'month': day.month, |
| 2898 |
|
'year': day.year, |
| 2899 |
|
} |
| 2900 |
|
|
| 2901 |
|
|