|
@@ 521-536 (lines=16) @@
|
| 518 |
|
li = last_soup.find('li', class_='prev' if next_ else 'next') |
| 519 |
|
return li.find('a') if li else None |
| 520 |
|
|
| 521 |
|
@classmethod |
| 522 |
|
def get_comic_info(cls, soup, link): |
| 523 |
|
"""Get information about a particular comics.""" |
| 524 |
|
short_url = soup.find('link', rel='shortlink')['href'] |
| 525 |
|
title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
| 526 |
|
imgs = soup.find_all('meta', property='og:image') |
| 527 |
|
date_str = soup.find('span', property='dc:date')['content'] |
| 528 |
|
date_str = date_str[:10] |
| 529 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 530 |
|
return { |
| 531 |
|
'short_url': short_url, |
| 532 |
|
'title': title, |
| 533 |
|
'img': [i['content'] for i in imgs], |
| 534 |
|
'day': day.day, |
| 535 |
|
'month': day.month, |
| 536 |
|
'year': day.year, |
| 537 |
|
} |
| 538 |
|
|
| 539 |
|
|
|
@@ 1784-1803 (lines=20) @@
|
| 1781 |
|
get_first_comic_link = simulate_first_link |
| 1782 |
|
first_url = 'http://respawncomic.com/comic/c0001/' |
| 1783 |
|
|
| 1784 |
|
@classmethod |
| 1785 |
|
def get_comic_info(cls, soup, link): |
| 1786 |
|
"""Get information about a particular comics.""" |
| 1787 |
|
title = soup.find('meta', property='og:title')['content'] |
| 1788 |
|
author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
| 1789 |
|
date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
| 1790 |
|
date_str = date_str[:10] |
| 1791 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 1792 |
|
imgs = soup.find_all('meta', property='og:image') |
| 1793 |
|
skip_imgs = { |
| 1794 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
| 1795 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
| 1796 |
|
} |
| 1797 |
|
return { |
| 1798 |
|
'title': title, |
| 1799 |
|
'author': author, |
| 1800 |
|
'day': day.day, |
| 1801 |
|
'month': day.month, |
| 1802 |
|
'year': day.year, |
| 1803 |
|
'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
| 1804 |
|
} |
| 1805 |
|
|
| 1806 |
|
|
|
@@ 2935-2949 (lines=15) @@
|
| 2932 |
|
# prev is next / next is prev |
| 2933 |
|
return last_soup.find('li', class_='previous' if next_ else 'next').find('a') |
| 2934 |
|
|
| 2935 |
|
@classmethod |
| 2936 |
|
def get_comic_info(cls, soup, link): |
| 2937 |
|
"""Get information about a particular comics.""" |
| 2938 |
|
date_str = soup.find('time', class_='published')['datetime'] |
| 2939 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2940 |
|
author = soup.find('span', class_='blog-author').find('a').string |
| 2941 |
|
title = soup.find('meta', property='og:title')['content'] |
| 2942 |
|
imgs = soup.find_all('meta', itemprop='image') |
| 2943 |
|
return { |
| 2944 |
|
'img': [i['content'] for i in imgs], |
| 2945 |
|
'title': title, |
| 2946 |
|
'author': author, |
| 2947 |
|
'day': day.day, |
| 2948 |
|
'month': day.month, |
| 2949 |
|
'year': day.year, |
| 2950 |
|
} |
| 2951 |
|
|
| 2952 |
|
|