|
@@ 1806-1825 (lines=20) @@
|
| 1803 |
|
get_first_comic_link = simulate_first_link |
| 1804 |
|
first_url = 'http://respawncomic.com/comic/c0001/' |
| 1805 |
|
|
| 1806 |
|
@classmethod |
| 1807 |
|
def get_comic_info(cls, soup, link): |
| 1808 |
|
"""Get information about a particular comics.""" |
| 1809 |
|
title = soup.find('meta', property='og:title')['content'] |
| 1810 |
|
author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
| 1811 |
|
date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
| 1812 |
|
date_str = date_str[:10] |
| 1813 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 1814 |
|
imgs = soup.find_all('meta', property='og:image') |
| 1815 |
|
skip_imgs = { |
| 1816 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
| 1817 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
| 1818 |
|
} |
| 1819 |
|
return { |
| 1820 |
|
'title': title, |
| 1821 |
|
'author': author, |
| 1822 |
|
'day': day.day, |
| 1823 |
|
'month': day.month, |
| 1824 |
|
'year': day.year, |
| 1825 |
|
'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
| 1826 |
|
} |
| 1827 |
|
|
| 1828 |
|
|
|
@@ 523-538 (lines=16) @@
|
| 520 |
|
li = last_soup.find('li', class_='prev' if next_ else 'next') |
| 521 |
|
return li.find('a') if li else None |
| 522 |
|
|
| 523 |
|
@classmethod |
| 524 |
|
def get_comic_info(cls, soup, link): |
| 525 |
|
"""Get information about a particular comics.""" |
| 526 |
|
short_url = soup.find('link', rel='shortlink')['href'] |
| 527 |
|
title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
| 528 |
|
imgs = soup.find_all('meta', property='og:image') |
| 529 |
|
date_str = soup.find('span', property='dc:date')['content'] |
| 530 |
|
date_str = date_str[:10] |
| 531 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 532 |
|
return { |
| 533 |
|
'short_url': short_url, |
| 534 |
|
'title': title, |
| 535 |
|
'img': [i['content'] for i in imgs], |
| 536 |
|
'day': day.day, |
| 537 |
|
'month': day.month, |
| 538 |
|
'year': day.year, |
| 539 |
|
} |
| 540 |
|
|
| 541 |
|
|