@@ 1766-1785 (lines=20) @@ | ||
1763 | """Get link to first comics.""" |
|
1764 | return {'href': 'http://respawncomic.com/comic/c0001/'} |
|
1765 | ||
1766 | @classmethod |
|
1767 | def get_comic_info(cls, soup, link): |
|
1768 | """Get information about a particular comics.""" |
|
1769 | title = soup.find('meta', property='og:title')['content'] |
|
1770 | author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
|
1771 | date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
|
1772 | date_str = date_str[:10] |
|
1773 | day = string_to_date(date_str, "%Y-%m-%d") |
|
1774 | imgs = soup.find_all('meta', property='og:image') |
|
1775 | skip_imgs = { |
|
1776 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
|
1777 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
|
1778 | } |
|
1779 | return { |
|
1780 | 'title': title, |
|
1781 | 'author': author, |
|
1782 | 'day': day.day, |
|
1783 | 'month': day.month, |
|
1784 | 'year': day.year, |
|
1785 | 'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
|
1786 | } |
|
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 |