@@ 1852-1871 (lines=20) @@ | ||
1849 | get_first_comic_link = simulate_first_link |
|
1850 | first_url = 'http://respawncomic.com/comic/c0001/' |
|
1851 | ||
1852 | @classmethod |
|
1853 | def get_comic_info(cls, soup, link): |
|
1854 | """Get information about a particular comics.""" |
|
1855 | title = soup.find('meta', property='og:title')['content'] |
|
1856 | author = soup.find('meta', attrs={'name': 'shareaholic:article_author_name'})['content'] |
|
1857 | date_str = soup.find('meta', attrs={'name': 'shareaholic:article_published_time'})['content'] |
|
1858 | date_str = date_str[:10] |
|
1859 | day = string_to_date(date_str, "%Y-%m-%d") |
|
1860 | imgs = soup.find_all('meta', property='og:image') |
|
1861 | skip_imgs = { |
|
1862 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/HAROLD2.png', |
|
1863 | 'http://respawncomic.com/wp-content/uploads/2016/03/site/DEVA.png' |
|
1864 | } |
|
1865 | return { |
|
1866 | 'title': title, |
|
1867 | 'author': author, |
|
1868 | 'day': day.day, |
|
1869 | 'month': day.month, |
|
1870 | 'year': day.year, |
|
1871 | 'img': [i['content'] for i in imgs if i['content'] not in skip_imgs], |
|
1872 | } |
|
1873 | ||
1874 | ||
@@ 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 |