|
@@ 574-589 (lines=16) @@
|
| 571 |
|
li = last_soup.find('li', class_='prev' if next_ else 'next') |
| 572 |
|
return li.find('a') if li else None |
| 573 |
|
|
| 574 |
|
@classmethod |
| 575 |
|
def get_comic_info(cls, soup, link): |
| 576 |
|
"""Get information about a particular comics.""" |
| 577 |
|
short_url = soup.find('link', rel='shortlink')['href'] |
| 578 |
|
title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
| 579 |
|
imgs = soup.find_all('meta', property='og:image') |
| 580 |
|
date_str = soup.find('span', property='dc:date')['content'] |
| 581 |
|
date_str = date_str[:10] |
| 582 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 583 |
|
return { |
| 584 |
|
'short_url': short_url, |
| 585 |
|
'title': title, |
| 586 |
|
'img': [i['content'] for i in imgs], |
| 587 |
|
'day': day.day, |
| 588 |
|
'month': day.month, |
| 589 |
|
'year': day.year, |
| 590 |
|
} |
| 591 |
|
|
| 592 |
|
|
|
@@ 1853-1872 (lines=20) @@
|
| 1850 |
|
get_first_comic_link = simulate_first_link |
| 1851 |
|
first_url = 'http://respawncomic.com/comic/c0001/' |
| 1852 |
|
|
| 1853 |
|
@classmethod |
| 1854 |
|
def get_comic_info(cls, soup, link): |
| 1855 |
|
"""Get information about a particular comics.""" |
| 1856 |
|
title = soup.find('meta', property='og:title')['content'] |
| 1857 |
|
author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
| 1858 |
|
date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
| 1859 |
|
date_str = date_str[:10] |
| 1860 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 1861 |
|
imgs = soup.find_all('meta', property='og:image') |
| 1862 |
|
skip_imgs = { |
| 1863 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
| 1864 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
| 1865 |
|
} |
| 1866 |
|
return { |
| 1867 |
|
'title': title, |
| 1868 |
|
'author': author, |
| 1869 |
|
'day': day.day, |
| 1870 |
|
'month': day.month, |
| 1871 |
|
'year': day.year, |
| 1872 |
|
'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
| 1873 |
|
} |
| 1874 |
|
|
| 1875 |
|
|
|
@@ 1669-1683 (lines=15) @@
|
| 1666 |
|
div = last_soup.find('div', title='next' if next_ else 'previous') |
| 1667 |
|
return None if div is None else div.find('a') |
| 1668 |
|
|
| 1669 |
|
@classmethod |
| 1670 |
|
def get_comic_info(cls, soup, link): |
| 1671 |
|
"""Get information about a particular comics.""" |
| 1672 |
|
title = soup.find('meta', property='og:title')['content'] |
| 1673 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 1674 |
|
imgs = soup.find_all('meta', property='og:image') |
| 1675 |
|
date_str = soup.find('span', class_='post-date').find('time').string |
| 1676 |
|
day = string_to_date(date_str, "%d %b %Y") |
| 1677 |
|
return { |
| 1678 |
|
'month': day.month, |
| 1679 |
|
'year': day.year, |
| 1680 |
|
'day': day.day, |
| 1681 |
|
'img': [i['content'] for i in imgs], |
| 1682 |
|
'title': title, |
| 1683 |
|
'description': desc, |
| 1684 |
|
} |
| 1685 |
|
|
| 1686 |
|
|