@@ 1801-1820 (lines=20) @@ | ||
1798 | get_first_comic_link = simulate_first_link |
|
1799 | first_url = 'http://respawncomic.com/comic/c0001/' |
|
1800 | ||
1801 | @classmethod |
|
1802 | def get_comic_info(cls, soup, link): |
|
1803 | """Get information about a particular comics.""" |
|
1804 | title = soup.find('meta', property='og:title')['content'] |
|
1805 | author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
|
1806 | date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
|
1807 | date_str = date_str[:10] |
|
1808 | day = string_to_date(date_str, "%Y-%m-%d") |
|
1809 | imgs = soup.find_all('meta', property='og:image') |
|
1810 | skip_imgs = { |
|
1811 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
|
1812 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
|
1813 | } |
|
1814 | return { |
|
1815 | 'title': title, |
|
1816 | 'author': author, |
|
1817 | 'day': day.day, |
|
1818 | 'month': day.month, |
|
1819 | 'year': day.year, |
|
1820 | 'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
|
1821 | } |
|
1822 | ||
1823 | ||
@@ 556-571 (lines=16) @@ | ||
553 | li = last_soup.find('li', class_='prev' if next_ else 'next') |
|
554 | return li.find('a') if li else None |
|
555 | ||
556 | @classmethod |
|
557 | def get_comic_info(cls, soup, link): |
|
558 | """Get information about a particular comics.""" |
|
559 | short_url = soup.find('link', rel='shortlink')['href'] |
|
560 | title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
|
561 | imgs = soup.find_all('meta', property='og:image') |
|
562 | date_str = soup.find('span', property='dc:date')['content'] |
|
563 | date_str = date_str[:10] |
|
564 | day = string_to_date(date_str, "%Y-%m-%d") |
|
565 | return { |
|
566 | 'short_url': short_url, |
|
567 | 'title': title, |
|
568 | 'img': [i['content'] for i in imgs], |
|
569 | 'day': day.day, |
|
570 | 'month': day.month, |
|
571 | 'year': day.year, |
|
572 | } |
|
573 | ||
574 |