|
@@ 1879-1898 (lines=20) @@
|
| 1876 |
|
get_first_comic_link = simulate_first_link |
| 1877 |
|
first_url = 'http://respawncomic.com/comic/c0001/' |
| 1878 |
|
|
| 1879 |
|
@classmethod |
| 1880 |
|
def get_comic_info(cls, soup, link): |
| 1881 |
|
"""Get information about a particular comics.""" |
| 1882 |
|
title = soup.find('meta', property='og:title')['content'] |
| 1883 |
|
author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
| 1884 |
|
date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
| 1885 |
|
date_str = date_str[:10] |
| 1886 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 1887 |
|
imgs = soup.find_all('meta', property='og:image') |
| 1888 |
|
skip_imgs = { |
| 1889 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
| 1890 |
|
'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
| 1891 |
|
} |
| 1892 |
|
return { |
| 1893 |
|
'title': title, |
| 1894 |
|
'author': author, |
| 1895 |
|
'day': day.day, |
| 1896 |
|
'month': day.month, |
| 1897 |
|
'year': day.year, |
| 1898 |
|
'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
| 1899 |
|
} |
| 1900 |
|
|
| 1901 |
|
|
|
@@ 600-615 (lines=16) @@
|
| 597 |
|
li = last_soup.find('li', class_='prev' if next_ else 'next') |
| 598 |
|
return li.find('a') if li else None |
| 599 |
|
|
| 600 |
|
@classmethod |
| 601 |
|
def get_comic_info(cls, soup, link): |
| 602 |
|
"""Get information about a particular comics.""" |
| 603 |
|
short_url = soup.find('link', rel='shortlink')['href'] |
| 604 |
|
title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
| 605 |
|
imgs = soup.find_all('meta', property='og:image') |
| 606 |
|
date_str = soup.find('span', property='dc:date')['content'] |
| 607 |
|
date_str = date_str[:10] |
| 608 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 609 |
|
return { |
| 610 |
|
'short_url': short_url, |
| 611 |
|
'title': title, |
| 612 |
|
'img': [i['content'] for i in imgs], |
| 613 |
|
'day': day.day, |
| 614 |
|
'month': day.month, |
| 615 |
|
'year': day.year, |
| 616 |
|
} |
| 617 |
|
|
| 618 |
|
|